Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple definiton compile error

Status
Not open for further replies.

ezeke1

Programmer
Mar 20, 2003
41
US
Hi All, maybe you can help with this compile error.

While compiling with gcc, I get an error that states
callbacks.o: In function 'create_window1':
/usr2/accounts/joeschmoe/project/interface.c:27: multiple definition of 'create_window1'
interface.o:/usr2/accounts/joeschmoe/project/interface.c:27 first defined here
collect2: ld returned 1 exit status
make: ***[frontend] Error 1



My current understanding of the code is that the compiler thinks there are multiple definitions of the ftn, but that should not be the case. Can anyone give me some advice or help me understand whats going on?

Thanks,
David
 
One of the usual ways of getting this is by putting source code (ie function definitions) inside header files, then including those header files in multiple source files.

But your error messages tell you where to look.
callbacks.c and interface.c

--
 
Thanks for the response Salem!

My ftn prototypes are in my header files and the ftn definitions are in my source files. What you stated makes sense. I'll doublecheck my header and source files to make sure I didn't define any ftns in the headers.

David
 
believe the compiler: you are
including|linking twice the same file|function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top