This topic is now archived and is closed to further replies.


for the users of the Gnu Linker

Recommended Posts

Hi , I´m having problems using the Gnu linker Let´s say for example that we have three files to think about , MainFile.c , f2.h , f2.c The MainFile uses functions declared in f2.h , and also uses some printf´s , for example MainFile.c #include #include "f2.h" int main() { int x; x = FuncImplementedInF2C(); printf("%i",x); } Then I compile MainFile.c and f2.c , that generate MainFile.o and f2.o, and then when I try to link I use : ld -o Prog.exe MainFile.o f2.o -lc The final -lc represents that I´m using the libc.a library , that has the implementation of printf , but when I try this I got lots of undefined references for the stranger files ever . Does anyone now how to use ld properly ? Even when I take off the printf´s and try to link I receive the warning :cannot find entry symbol start. There is a Prog.exe generated but when I try to run it , the DOS window is shutdown and windows says that a illegal operation has ocurred. Can anyone help me on this one?

Share this post

Link to post
Share on other sites