This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ link errors using gcc from cvs


I recently installed gcc from cvs, since I understand people have had success with it, pretty much
out of the box. I'm getting link errors compiling trival C++ programs, with both my local g++ and
the Cygwin standard g++. I can overcome these errors if I explicitly link the right copy of
libstdc++.a into the application, as demonstrated in the examples below.
Can gcc 2.95 and gcc 3.x not coexist? I'm guessing it's either that or I installed gcc incorrectly
somehow, but I'm not sure where I went wrong. Any help or direction would be appreciated.
Christopher
Examples (cygcheck output is at the bottom, if it helps):
$ cat foo.cc
#include <iostream>
int
main()
 std::cout << "Hello, world!\n";
 return 0;
$ uname -a
CYGWIN_NT-5.0 CCURRIE 1.3.10(0.51/3/2) 2002年02月25日 11:14 i686 unknown
$ g++-3.1 -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-cygwin/3.1/specs
Configured with: /usr/src/gcc-3_1/configure --disable-nls --disable-shared --ena
ble-static --enable-cstdio=stdio --with-system-zlib --enable-languages=c,c++ --e
nable-threads=win32 --program-suffix=-3.1
Thread model: win32
gcc version 3.1 20020316 (prerelease)
$ g++-3.1 -o foo foo.cc
/tmp/ccZLqlSf.o(.text+0x31):foo.cc: undefined reference to `std::cout'
/tmp/ccZLqlSf.o(.text+0x3e):foo.cc: undefined reference to `std::basic_ostream<c
har, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::ba
sic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccZLqlSf.o(.text+0x67):foo.cc: undefined reference to `std::ios_base::Init:
:Init[in-charge]()'
/tmp/ccZLqlSf.o(.text+0x82):foo.cc: undefined reference to `std::ios_base::Init:
:~Init [in-charge]()'
/tmp/ccZLqlSf.o(.eh_frame+0x11):foo.cc: undefined reference to `___gxx_personali
ty_v0'
collect2: ld returned 1 exit status
$ g++-3.1 -o foo foo.cc /usr/local/lib/libstdc++.a
$ ./foo
Hello, world!
$ g++ -o foo foo.cc
/tmp/ccf7Qhwz.o(.text+0x24):foo.cc: undefined reference to `cout'
/tmp/ccf7Qhwz.o(.text+0x29):foo.cc: undefined reference to `ostream::operator<<(
char const *)'
collect2: ld returned 1 exit status
$ g++ -o foo foo.cc /usr/lib/libstdc++.a
$ ./foo
Hello, world!
$ cygcheck.exe -s -v -r
Cygwin Win95/NT Configuration Diagnostics
Current System Time: Sun Mar 17 23:32:51 2002
Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 2
Path:	C:\cygwin\usr\local\bin
	C:\cygwin\bin
	C:\cygwin\bin
	c:\WINNT\system32
	c:\WINNT
	c:\WINNT\System32\Wbem
SysDir: C:\WINNT\System32
WinDir: C:\WINNT
HOME = `C:\cygwin\home\ccurrie'
MAKE_MODE = `unix'
PWD = `/home/ccurrie/src/test'
USER = `ccurrie'
ALLUSERSPROFILE = `C:\Documents and Settings\All Users'
APPDATA = `C:\Documents and Settings\ccurrie\Application Data'
COMMONPROGRAMFILES = `C:\Program Files\Common Files'
COMPUTERNAME = `CCURRIE'
COMSPEC = `C:\WINNT\system32\cmd.exe'
HOMEDRIVE = `C:'
HOMEPATH = `\'
LOGONSERVER = `\\CCURRIE'
MANPATH = `:/usr/ssl/man'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/home/ccurrie/src'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 8 Stepping 3, GenuineIntel'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0803'
PROGRAMFILES = `C:\Program Files'
PROMPT = `$P$G'
PS1 = `\[033円]0;\w007円
033円[32m\]\u@\h \[033円[33m\w033円[0m\]
$ '
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `c:\DOCUME~1\ccurrie\LOCALS~1\Temp'
TERM = `cygwin'
TMP = `C:\cygwin\tmp'
USERDOMAIN = `CCURRIE'
USERNAME = `ccurrie'
USERPROFILE = `C:\Documents and Settings\ccurrie'
WINDIR = `C:\WINNT'
_ = `/usr/bin/cygcheck.exe'
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
 (default) = `/cygdrive'
 cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
 (default) = `C:/cygwin'
 flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
 (default) = `C:/cygwin/bin'
 flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
 (default) = `C:/cygwin/lib'
 flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
c: hd NTFS 11507Mb 35% CP CS UN PA FC 
. /cygdrive user binmode,noumount
C:/cygwin / system binmode
C:/cygwin/bin /usr/bin system binmode
C:/cygwin/lib /usr/lib system binmode
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\sh.exe
 56k 2000年12月03日 C:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
 "cygbz21.0.dll" v0.0 ts=2000年11月20日 18:53
 621k 2002年01月16日 C:\cygwin\bin\cygcrypto.dll - os=4.0 img=1.0 sys=4.0
 "cygcrypto.dll" v0.0 ts=2002年1月16日 4:54
 45k 2001年04月25日 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
 "cygform5.dll" v0.0 ts=2001年4月25日 1:28
 35k 2002年01月09日 C:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
 "cygform6.dll" v0.0 ts=2002年1月9日 1:03
 19k 2002年02月20日 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
 "cyggdbm.dll" v0.0 ts=2002年2月19日 22:05
 17k 2001年06月28日 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
 "cyghistory4.dll" v0.0 ts=2001年1月6日 23:34
 20k 2002年01月13日 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
 "cyghistory5.dll" v0.0 ts=2002年1月12日 20:27
 22k 2001年12月13日 C:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
 "cygintl-1.dll" v0.0 ts=2001年12月13日 4:28
 21k 2001年06月20日 C:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
 "cygintl.dll" v0.0 ts=2001年6月20日 13:09
 81k 2001年10月20日 C:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
 "cygitcl30.dll" v0.0 ts=2001年10月19日 20:25
 35k 2001年10月20日 C:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
 "cygitk30.dll" v0.0 ts=2001年10月19日 20:25
 26k 2001年04月25日 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
 "cygmenu5.dll" v0.0 ts=2001年4月25日 1:27
 20k 2002年01月09日 C:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
 "cygmenu6.dll" v0.0 ts=2002年1月9日 1:03
 156k 2001年04月25日 C:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
 "cygncurses++5.dll" v0.0 ts=2001年4月25日 1:29
 175k 2002年01月09日 C:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
 "cygncurses++6.dll" v0.0 ts=2002年1月9日 1:03
 226k 2001年04月25日 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
 "cygncurses5.dll" v0.0 ts=2001年4月25日 1:17
 202k 2002年01月09日 C:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
 "cygncurses6.dll" v0.0 ts=2002年1月9日 1:03
 15k 2001年04月25日 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
 "cygpanel5.dll" v0.0 ts=2001年4月25日 1:27
 12k 2002年01月09日 C:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
 "cygpanel6.dll" v0.0 ts=2002年1月9日 1:03
 40k 2001年11月21日 C:\cygwin\bin\cygpcre.dll - os=4.0 img=1.0 sys=4.0
 "cygpcre.dll" v0.0 ts=2001年11月21日 17:15
 39k 2001年11月21日 C:\cygwin\bin\cygpcreposix.dll - os=4.0 img=1.0 sys=4.0
 "cygpcreposix.dll" v0.0 ts=2001年11月21日 17:15
 108k 2001年06月28日 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
 "cygreadline4.dll" v0.0 ts=2001年1月6日 23:34
 121k 2002年01月13日 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
 "cygreadline5.dll" v0.0 ts=2002年1月12日 20:27
 156k 2002年01月16日 C:\cygwin\bin\cygssl.dll - os=4.0 img=1.0 sys=4.0
 "cygssl.dll" v0.0 ts=2002年1月16日 4:54
 390k 2001年10月20日 C:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
 "cygtcl80.dll" v0.0 ts=2001年10月19日 20:24
 5k 2001年10月20日 C:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
 10k 2001年10月20日 C:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
 "cygtclreg80.dll" v0.0 ts=2001年10月19日 20:24
 623k 2001年10月20日 C:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
 "cygtk80.dll" v0.0 ts=2001年10月19日 20:25
 50k 2002年03月12日 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
 "cygz.dll" v0.0 ts=2002年3月11日 23:38
 751k 2002年02月25日 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
 "cygwin1.dll" v0.0 ts=2002年2月25日 11:14
 Cygwin DLL version info:
 DLL version: 1.3.10
 DLL epoch: 19
 DLL bad signal mask: 19005
 DLL old termios: 5
 DLL malloc env: 28
 API major: 0
 API minor: 51
 Shared data: 3
 DLL identifier: cygwin1
 Mount registry: 2
 Cygnus registry name: Cygnus Solutions
 Cygwin registry name: Cygwin
 Program options name: Program Options
 Cygwin mount registry name: mounts v2
 Cygdrive flags: cygdrive flags
 Cygdrive prefix: cygdrive prefix
 Cygdrive default prefix: 
 Build date: Mon Feb 25 11:14:34 EST 2002
 Shared id: cygwin1S3
Cygwin Package Information
Last downloaded files to: C:\Documents and Settings\ccurrie\My Documents\cygwin
Last downloaded files from: http://mirrors.rcn.net/pub/sourceware/cygwin
Package Version 
ash 20020131-1 
autoconf 2.52c-1 
autoconf-devel 2.52-4 
autoconf-stable 2.13-4 
automake 1.6a-1 
automake-devel 1.5-5 
automake-stable 1.4p5-5 
bash 2.05a-3 
binutils 20011002-1 
bison 1.33-1 
bzip2 1.0.1-6 
crypt 1.0-1 
cvs 1.11.0-1 
cygwin 1.3.10-1 
diff 0.0 
fileutils 4.1-1 
findutils 4.1 
flex 2.5.4-1 
gawk 3.0.4-1 
gcc 2.95.3-5 
gdb 20010428-3 
gdbm 1.8.0-4 
grep 2.5g 
groff 1.17.2-1 
gzip 1.3.2-1 
less 358-3 
libintl 0.10.38-3 
libintl1 0.10.40-1 
libncurses5 5.2-1 
libncurses6 5.2-8 
libreadline4 4.1-2 
libreadline5 4.2a-1 
login 1.4-3 
m4 0.0 
make 3.79.1-5 
man 1.5g-2 
mktemp 1.4-1 
ncftp 3.1.2-1 
ncurses 5.2-8 
newlib-man 20001118-1 
openssh 3.1p1-1 
openssl 0.9.6c-3 
pcre 3.7-1 
perl 5.6.1-2 
readline 4.2a-1 
sed 3.02-1 
sh-utils 2.0-2 
tar 1.13.19-1 
termcap 20010825-1 
terminfo 5.2-1 
texinfo 4.0-5 
textutils 2.0.21-1 
vim 6.0.93-1 
w32api 1.2-1 
which 1.5-1 
zlib 1.1.4-1 
Use -h to see help about each section
-------------------------------------------------------
With reasonable men I will reason;
with humane men I will plead;
but to tyrants I will give no quarter.
 -- William Lloyd Garrison
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

AltStyle によって変換されたページ (->オリジナル) /