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!

gcc Compile error

Status
Not open for further replies.

dcusick

Technical User
Aug 9, 2000
271
US
Okay, I'm in desperate need of some help here!! I can't get my application to compile. I'm compiling with gcc and I keep getting the linker errors "Undefined Symobols". I'm not overly familiar with gcc and unix, so I might be including incorrectly. I have a header file with all my function prototypes. I have a .c file that defines all of these functions. I can compile the .c file fine. However, I have a new file that I was given to use. It has my header file included in it. When I try to compile it, I get the undefined symbols error, and all the symbols listed are the function prototypes. How do I include the .c file that has the definitions in it?
 
Are you looking for the -c option for gcc? That lets you compile something to a .o file, which can have unresolved references.

Are you trying to link with the current .o file where you defined the functions? Just specify that file on the command line when you try to compile/link. If it's a library you have instead, look at the -l (lower-case L) and -L options.


BTW, linker errors != compile errors.
 
Oh, and I don't know how you can compile that one .c file without knowing about the -c option, but if you did so by putting a main function in that file, you should take that out before someone gets really mad at you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top