delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/11/08/13:45:03

From: Martin Str|mberg <ams AT speedy DOT ludd DOT luth DOT se>
Subject: Re: ld: what is causing this?
Newsgroups: comp.os.msdos.djgpp
References: <sfpnsukdt3pb21a7luhnfgphsnc1crc116 AT 4ax DOT com> <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 <chas AT pcscs DOT com> wrote:
: On Fri, 08 Nov 2002 11:33:22 -0500, Charles Wilkins <chas AT pcscs DOT com>
: 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 "<number> T _main" or some thing like that, not "<number> T
main".


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019