> Newsgroups: comp.os.msdos.djgpp
> Subject: A Linking problem
> Date: Thursday, June 03, 1999 4:17 PM
> I am have a bit of trouble linking my *.o files. I am trying to port a
> to run at dos. The *.c files compile fine, but when I type "gcc -o
> filename.exe *.o" I get a long list of things that say undefined
> and it seems to be all of the functions. At the end of the linking
> there is a message....
commandline - I think! Rather create a makefile (take a look at LAMETRO on
WWW page if you do not know how) and assign all the object filenames in the
way I did in LAMETRO's makefile. This automatically feeds all the .O
filenames to GCC AT ONCE at the correct time and enables you to compile the
program (I think!)
This means that the main program function is not present - take a look atQuote:> "c:\djgpp\lib\libc.a(crt1.o)(.text+0x446):crt1.c:undefined reference to
the make file for LAMETRO - you need to define a source file that has the
"main" function in it. What happens above is that GCC obliging compiles,
but when it comes time to create the .EXE it can't find the .O file with
the "main()" function - it thus complains with the text+0x446 error message
that it cannot find main. It is considered an "underfined reference" since
it is "referenced" by default. Remember from basic C class that when a C
program starts, it always starts at the top of main() - if it cannot find
it - BLOOEY! The compiler stops with a link time error.
No problem!Quote:> thank you very much!!
This message courtesy of
StarWars for ever!.