www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/12/01:57:03

To: jeearr AT dns1 DOT cpcc DOT cc DOT nc DOT us (Jeearr the Demon of Chaos)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: linking problem with ld?
Date: Thu, 12 Jan 95 08:16:51 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>

> When trying to compile a small program (using a Makefile cause it should grow
> considerably soon) i got the following error
>
> gcc -o intro.o -c -g -Wall -Wshadow -Wconversion -Wstrict-prototypes
>                      -Wredundant-decls  intro.c
>
> ld intro.o  -o truth -Ld:/djgpp/lib -lc -lgcc
> d:/djgpp/bin/ld.exe: warning: cannot find entry symbol _start; defaulting to 000000a8
>
> ctordtor.c(.text+0x5): undefined reference to `__go32_last_ctor'

That's because you gave ld incorrect command line.
Invoking ld from a command line is not the recommended technique
for first-time users.  It's best to call it via gcc driver which
will then take care of some mundane details that slipped you.  For
instance in this case you forgot the crt0.o start-up code, and
also failed to mention -lgcc *before* -lc (yes, it should be
twice on the command line, both before and after -lc).  You should
instead write in your Makefile this rule:

	gcc -o truth intro.o

and gcc will do it for you.  If you are eager to see what command
line gcc uses when calling ld, add -v to the above command line:

	gcc -v -o truth intro.o

- Raw text -


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