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

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Auth-Info: wYn1L2sxhbxC+4QefmC61d3w1sJ/F1nb+WXyt9u7MDM=
From: "Dr. Xiangdong Wang" <xiangdong DOT wang AT charismathics DOT com>
To: <djgpp AT delorie DOT com>
Subject: Help: Problem to link C++ program with ld
Date: Tue, 23 May 2006 09:01:22 +0200
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
Thread-Index: AcZ6mJnDeIq8gApXQASLy9CJkTRFdwAndI7gAL/lPMA=
Message-Id: <20060523070118.450B69176A@mail.m-online.net>
Reply-To: djgpp AT delorie DOT com

I wrote a small C++ code

int main()
{
	try
	{
		int a = 1;
		if ( a != 1) throw "a != 1";
	}
	catch(...)
	{
	}
	return 1;
} 

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;
defaulting to 000018d0
	main.o(.text+0x37):main.cpp: undefined reference to
`__cxa_allocate_exception'
	main.o(.text+0x4a):main.cpp: undefined reference to `typeinfo for
char const*'
	main.o(.text+0x50):main.cpp: undefined reference to `__cxa_throw'
	main.o(.text+0x59):main.cpp: undefined reference to
`__cxa_begin_catch'
	main.o(.text+0x61):main.cpp: undefined reference to
`__cxa_end_catch'
	main.o(.eh_frame+0x12):main.cpp: undefined reference to
`__gxx_personality_v0'
	make.exe: *** [main.bin] Error 1

Does anybody have any suggestion for me ?

best regards


Dr. Xiangdong Wang (CTO)
Charismathics GmbH
47 sendlinger st
munich, germany 80331
Tel. +49 89 30906720
Fax. +49 89 30906729
Mobile: +49 177 4453742
xiangdong DOT wang AT charismathics DOT com
www.charismathics.com


- Raw text -


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