From: Martin Str|mberg Subject: Re: ld: what is causing this? Newsgroups: comp.os.msdos.djgpp References: <4lunsukkrfjh1arjvdon910hm8fn6om2h5 AT 4ax DOT com> User-Agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (NetBSD/1.5_BETA (alpha)) Message-ID: <1036780332.535222@queeg.ludd.luth.se> Cache-Post-Path: queeg.ludd.luth.se!unknown AT speedy DOT ludd DOT luth DOT se X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Date: 08 Nov 2002 18:32:12 GMT Lines: 46 NNTP-Posting-Host: queeg.ludd.luth.se X-Trace: 1036780332 news.luth.se 7334 130.240.16.109 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Charles Wilkins wrote: : On Fri, 08 Nov 2002 11:33:22 -0500, Charles Wilkins : wrote: :>Given the case for linux host crosscompiler i686-pc-msdosdjgpp-gcc.. :> :>i686-pc-msdosdjgpp-gcc -Wl,--verbose :> :>(/usr/local/compiler/cross/djgpp/lib/gcc-lib/i686-pc-msdosdjgpp/3.2/../../../../i6/usr/local/compiler/cross/djgpp/lib/gcc-lib/i686-pc-msdosdjgpp/3.2/../../../../i686-pc-msdosdjgpp/lib/crt0.o(.data+0xc2):crt0.s: :>undefined reference to `_main' :> :>/usr/local/compiler/cross/djgpp/lib/gcc-lib/i686-pc-msdosdjgpp/3.2/../../../../i686-pc-msdosdjgpp/lib/libc.a(crt1.o)(.text+0x404):crt1.c: :>undefined reference to `_main' :> :>** Notice the mangled path above ~/../i6/usr/local/~ : ok it seems the output was simply piped out of order, but the question : still remains as to what could be causing the undefined reference. : I assume that the output should be read as: : (/usr/local/compiler/cross/djgpp/lib/gcc-lib/i686-pc-msdosdjgpp/3.2/../../../../i686-pc-msdosdjgpp/lib/libc.a)fflush.o : /usr/local/compiler/cross/djgpp/lib/gcc-lib/i686-pc-msdosdjgpp/3.2/../../../../i686-pc-msdosdjgpp/lib/crt0.o(.data+0xc2):crt0.s: : undefined reference to `_main' : /usr/local/compiler/cross/djgpp/lib/gcc-lib/i686-pc-msdosdjgpp/3.2/../../../../i686-pc-msdosdjgpp/lib/libc.a(crt1.o)(.text+0x404):crt1.c: : undefined reference to `_main' You didn't say what you are compiling. Giving us the command line that resulted in this would be benificial. As far as I can see whatever you're compiling/linking don't have a main() function. You might have the problem of not having an "_" in front of every C identifier. Find the .o where the main() is supposed to be and run "nm" on it. It should say " T _main" or some thing like that, not " T main". Right, MartinS