Thread View: gnu.gcc.help
3 messages
3 total messages
Started by Vince Tessier
Sun, 08 Nov 1992 23:14
I keep getting "ld: Undefined symbol ___main" errors
Author: Vince Tessier
Date: Sun, 08 Nov 1992 23:14
Date: Sun, 08 Nov 1992 23:14
34 lines
1744 bytes
1744 bytes
Mea culpa, mea maxima culpa ... I violated a cardinal rule by zapping something before its replacement was proven, and now I can't compile anything with gcc. I used to run gcc-2.2.1 just fine on my sparc. Then I built 2.2.2, and within a couple of days 2.3.1, configuring with ./configure --target=sparc-sun-sunos4.1.1 --with-gnu-ld The entire build and install process went just fine, compiling the compiler with itself, installing fixincludes, and so on. But every time I try to build another package, I can compile the object modules, but when I go to link the executable, I get a message of the form main.o(.text+4): undefined reference to `___main' If I build without the "--with-gnu-ld" option and make 'collect2' to call Sun ld, I get ld: Undefined symbol ___main collect: /usr/bin/ld returned 2 exit status Of course, I zapped my old gcc-2.2.1 after 2.2.1 and later 2.3.1 built, compared, and installed without problems; I don't recall how I had set 2.1.1 up (a while ago). I've looked through INSTALL, README, the info files, and browsed the sources for gcc and ld, and can't seem to find where I've gone wrong. -- Vince Tessier vtessier@vela.acs.oakland.edu "Think global, act loco." -- Zippy
Re: I keep getting "ld: Undefined symbol ___main" errors
Author: Andreas Manessinger
Date: Mon, 09 Nov 1992 15:21
Date: Mon, 09 Nov 1992 15:21
21 lines
1433 bytes
1433 bytes
>>>>> On Sun, 8 Nov 1992 23:14:55 GMT, vtessier@vela.acs.oakland.edu (Vince Tessier) said:
Vince> when I go to link the executable, I get a message of the form
Vince> main.o(.text+4): undefined reference to `___main'
`_main' is a symbol from `libgcc.a' that is automatically linked,
whenever you call `gcc' for linking. I believe that whenever you have
compiled the file that contains the function `main()', you have to
link using `gcc' or by issuing
`cc -o foo foo.o bar.o /usr(local/lib/gcc-lib/sun4/2.3.1/libgcc.a'
or wherever you have that library.
Hope that helps
--
/\ | eMail: man@magwien.gv.at (Andreas Manessinger)
/ \ndreas | pMail: Alserstra"se. 20/6; A-1090 Wien; Austria
/\/\ \ | Work : Gemeinde Wien MD-ADV/Ma; Ref. EPS
/ / \anessinger | Phone: +43 222 4039584/13, FAX: 4039584/18, Home: 9350434
Re: I keep getting "ld: Undefined symbol ___main" errors
Author: Vince Tessier
Date: Mon, 09 Nov 1992 21:52
Date: Mon, 09 Nov 1992 21:52
19 lines
1223 bytes
1223 bytes
man@magwien.gv.at (Andreas Manessinger) writes: >>>>>> On Sun, 8 Nov 1992 23:14:55 GMT, vtessier@vela.acs.oakland.edu (Vince Tessier) said: > Vince> when I go to link the executable, I get a message of the form > Vince> main.o(.text+4): undefined reference to `___main' >`_main' is a symbol from `libgcc.a' that is automatically linked, >whenever you call `gcc' for linking. My problem seems to be that libgcc.a *isn't* being linked in by gcc. I'm mostly building the other gnu packages, and a typical link command is of the form gcc -o foo bar.o zot.o quux.o which fails with the above message. This problem does not occur when -- Vince Tessier vtessier@vela.acs.oakland.edu "Think global, act loco." -- Zippy
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads