Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 80443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:18:12+00:00 2026-05-10T21:18:12+00:00

I have a project consisting of two files, main.c and logoff.c. When I try

  • 0

I have a project consisting of two files, main.c and logoff.c. When I try to compile them I get this error:

gcc -c -g -Wall main.c gcc -c -g -Wall logoff.c gcc -o main -g -Wall main.o logoff.o ld: duplicate symbol _logoff in logoff.o and main.o

I have a function named logoff in logoff.c, but I have searched main.c for the text ‘logoff’ and have found nothing (the function is not even called yet!).

If I change the name of the function to log_off it works. There is a second function in the file which then causes the same error unless its name is changed as well.

Is there any reason why this might occur? I have this problem on two different systems. One thing that might be relevant is that I used the same logoff.c file in another project but it is not connected to this one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:18:13+00:00Added an answer on May 10, 2026 at 9:18 pm

    Create a logoff.h file with only the function declaration of logoff, like

    void logoff(void);

    Then, in main.c include it with #include 'logoff.h'. Don’t include logoff.c, as the compiler will compile the function two times, and the linker will see two functions of that name then.

    It appears to work if you change it to log_off, and then only recompile one of them. The other object-file will still have the old logoff function compiled in. Thus the linker sees one log_off and one logoff. That’s the reason it appeared to work for you with that name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small project consisting of one maven project and two maven modules. One
I have a project consisting of four programs for different platforms; all of them
I have a project consisting of a window, a main view and many view
I have a project consisting of 3 libraries - let's call them 1) BABY,
I have started a new project consisting of one main.cpp file and an additional
Currently I have project consisting of multiple repositories, e.g.: +--- Project (main repo) +---
I have a project consisting of a windows client (approx. 150 users), a webservice
(By the way, I don't use Interface Builder) I have a little project consisting
I have project asp.net with namespace test and I'm using resources (files Resource.resx and
I have project on rails 3 with multiplayer using Faye. The error block in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.