delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/05/23/03:46:13

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Trace-PostClient-IP: 68.147.232.190
From: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT Invalid>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help: Problem to link C++ program with ld
Organization: Systematic Software
Message-ID: <35e572d48qjdqfr3igooo0gg5qkd289p9g@4ax.com>
References: <20060523070118 DOT 450B69176A AT mail DOT m-online DOT net>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Lines: 31
Date: Tue, 23 May 2006 07:36:37 GMT
NNTP-Posting-Host: 64.59.135.176
X-Complaints-To: abuse AT shaw DOT ca
X-Trace: pd7tw3no 1148369797 64.59.135.176 (Tue, 23 May 2006 01:36:37 MDT)
NNTP-Posting-Date: Tue, 23 May 2006 01:36:37 MDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Tue, 23 May 2006 09:01:22 +0200 in comp.os.msdos.djgpp, "Dr.
Xiangdong Wang" <xiangdong DOT wang AT charismathics DOT com> wrote:

>
>I wrote a small C++ code

>I can compile and link it with gxx
>	gxx main.cpp
>
>but if I link it with ld, 
>	ld -lc -lstdcx -lsupcxx -lgcc main.o -o main.bin

>I got a lot of "undefined reference":
>	D:\DJGPP\BIN/ld.exe: warning: cannot find entry symbol start;

Missing startup code crt0.o

>Does anybody have any suggestion for me ?

Use gxx instead of ld:
gxx -c main.cpp
gxx -o main.bin main.o

Add startup code:
ld -lc -lstdcxx -lsupcxx -lgcc $DJDIR/lib/crt0.o main.o -o main.bin

-- 
Thanks. Take care, Brian Inglis 	Calgary, Alberta, Canada

Brian DOT Inglis AT CSi DOT com 	(Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca)
    fake address		use address above to reply

- Raw text -


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