g++ link errors

Dean Scarff d_scarff@bigpond.com
Sun Dec 7 11:28:00 GMT 2003


Hi,
I'm getting link errors with libstdc++.  At first I thought I must have 
been missing a package, but AFAICS I have all the relevant ones.  I 
assumed libstdc++ would be linked in by default from a g++ command line. 
  I couldn't see anything similar mentioned in the archives.  I assume 
c++ wouldn't be broken by default for the whole distribution like this, 
what have I forgotten (and out of interest, why does the 3.3.1 version 
of gcc and g++ use the 3.2.3 specs)?

scarff-box ~ $ cat nolink.cc

#include <iostream>

using namespace std;

int
main(int, char**)
{
   cout << "hello.";
}

scarff-box ~ $ g++ -Wall -v nolink.cc
Reading specs from /usr/local/lib/gcc-lib/i686-pc-cygwin/3.2.3/specs
Configured with: ./configure --enable-languages=objective-c 
--with-system-zlib --without-included-gettext --host=i686-pc-cygwin 
--target=i686-pc-cygwin --prefix=/usr/local/ --exec-prefix=/usr/local : 
(reconfigured) ./configure --target=i686-pc-cygwin --prefix=/usr/local 
--with-as=/usr/bin/as.exe --with-ld=/usr/bin/ld.exe 
--enable-threads=win32 -enable-languages=c,c++,objc
Thread model: win32
gcc version 3.2.3
  /usr/local/lib/gcc-lib/i686-pc-cygwin/3.2.3/cc1plus.exe -v 
-D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 
-D__GXX_ABI_VERSION=102 -D_X86_=1 -D_X86_=1 -Asystem=winnt 
-D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 
-D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ 
-D__stdcall=__attribute__((__stdcall__)) 
-D__cdecl=__attribute__((__cdecl__)) 
-D_stdcall=__attribute__((__stdcall__)) 
-D_cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) 
-D__i386__ -D__i386 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ 
-D__unix -isystem /usr/local/include -idirafter 
/usr/local/i686-pc-cygwin/include -idirafter /usr/include -idirafter 
/usr/local/i686-pc-cygwin/include/w32api -idirafter /usr/include/w32api 
nolink.cc -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet -dumpbase 
nolink.cc -Wall -version -o 
/mnt/data/Profiles/scarff/LOCALS~1/Temp/ccSJf53h.s
ignoring nonexistent directory "/usr/local/i686-pc-cygwin/include"
ignoring nonexistent directory "/usr/local/i686-pc-cygwin/include/w32api"
GNU CPP version 3.2.3 (cpplib) (80386, BSD syntax)
GNU C++ version 3.2.3 (i686-pc-cygwin)
         compiled by GNU C version 3.2 20020927 (prerelease).
#include "..." search starts here:
#include <...> search starts here:
  /usr/local/include
  /usr/local/include/c++/3.2.3
  /usr/local/include/c++/3.2.3/i686-pc-cygwin
  /usr/local/include/c++/3.2.3/backward
  /usr/local/lib/gcc-lib/i686-pc-cygwin/3.2.3/include
  /usr/include
  /usr/include/w32api
End of search list.
  /usr/bin/as.exe --traditional-format -o 
/mnt/data/Profiles/scarff/LOCALS~1/Temp/ccLKD7P2.o 
/mnt/data/Profiles/scarff/LOCALS~1/Temp/ccSJf53h.s
  /usr/local/lib/gcc-lib/i686-pc-cygwin/3.2.3/collect2.exe 
-L/usr/local/i686-pc-cygwin/lib/w32api/ -L/usr/lib/w32api/ -Bdynamic 
--dll-search-prefix=cyg /usr/lib/crt0.o 
-L/usr/local/lib/gcc-lib/i686-pc-cygwin/3.2.3 -L/usr/lib/mingw 
/mnt/data/Profiles/scarff/LOCALS~1/Temp/ccLKD7P2.o -lstdc++ -lgcc 
-lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc
/usr/lib/mingw/libstdc++.a(ios.o)(.text+0x263):ios.cc: undefined 
reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(ios.o)(.text+0x29a):ios.cc: undefined 
reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(ios.o)(.text+0x2ce):ios.cc: undefined 
reference to `__imp___iob'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text+0x7d):eh_throw.cc: 
undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text+0x8e):eh_throw.cc: 
undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_throw.o)(.text+0xfd):eh_throw.cc: 
undefined reference to `__Unwind_SjLj_Resume_or_Rethrow'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockC2Ev+0x10):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockC2Ev+0x2b):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_lock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockC1Ev+0x11):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockC1Ev+0x2b):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_lock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockD2Ev+0x11):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockD2Ev+0x2b):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_unlock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockD1Ev+0x10):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE5_LockD1Ev+0x2b):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_unlock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0xac):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0xe4):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0xfb):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_unlock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0x151):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_lock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0x1ad):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0x1d6):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_unlock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x14):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x50):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x60):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x8e):stl-inst.cc: 
undefined reference to `___gthr_win32_once'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0xa0):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_lock'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0xa6):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0xc0):stl-inst.cc: 
undefined reference to `___gthr_win32_once'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0xc6):stl-inst.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(stl-inst.o)(.text$_ZNSt15_STL_mutex_lock13_M_initializeEv+0x7e):stl-inst.cc: 
undefined reference to `___gthr_win32_mutex_unlock'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text+0x95):eh_alloc.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text+0x128):eh_alloc.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text+0x172):eh_alloc.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text+0x1c8):eh_alloc.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_alloc.o)(.text+0x1ea):eh_alloc.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_globals.o)(.text+0x41):eh_globals.cc: 
undefined reference to `___mingwthr_key_dtor'
/usr/lib/mingw/libstdc++.a(eh_globals.o)(.text+0x1ba):eh_globals.cc: 
undefined reference to `__CRT_MT'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text+0x67):eh_terminate.cc: 
undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text+0x97):eh_terminate.cc: 
undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text+0xb3):eh_terminate.cc: 
undefined reference to `___w32_sharedptr_terminate'
/usr/lib/mingw/libstdc++.a(eh_terminate.o)(.text+0xd3):eh_terminate.cc: 
undefined reference to `___w32_sharedptr_unexpected'
/usr/lib/mingw/libstdc++.a(ctype.o)(.text+0x2):ctype.cc: undefined 
reference to `__imp___ctype'
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0x28):c++locale.cc: 
undefined reference to `__errno'
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0x5c):c++locale.cc: 
undefined reference to `__errno'
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0x98):c++locale.cc: 
undefined reference to `__errno'
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0xcc):c++locale.cc: 
undefined reference to `__errno'
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0x105):c++locale.cc: 
undefined reference to `__errno'
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0x13f):c++locale.cc: more 
undefined references to `__errno' follow
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0x3cf):c++locale.cc: 
undefined reference to `_strtold'
/usr/lib/mingw/libstdc++.a(c++locale.o)(.text+0x403):c++locale.cc: 
undefined reference to `__errno'
collect2: ld returned 1 exit status
scarff-box ~ $ cygcheck -c
Cygwin Package Information
Package              Version            Status
_update-info-dir     00225-1            OK
ash                  20031007-1         OK
autoconf             2.59-1             OK
autoconf-devel       2.59-1             OK
autoconf-stable      2.13-5             OK
automake             1.7.9-1            OK
automake-devel       1.7.9-1            OK
automake-stable      1.4p6-2            OK
base-files           2.6-1              OK
base-passwd          1.1-1              OK
bash                 2.05b-16           OK
binutils             20030901-1         OK
bison                20030307-1         OK
bzip2                1.0.2-5            OK
check                0.8.4-1            OK
clear                1.0-1              OK
crypt                1.1-1              OK
cvs                  1.11.6-3           OK
cygrunsrv            0.96-2             OK
cygutils             1.2.2-1            OK
cygwin               1.5.5-1            OK
cygwin-doc           1.3-6              OK
diff                 1.0-1              OK
diffutils            2.8.4-1            OK
docbook-xsl          1.62.4-1           OK
ed                   0.2-1              OK
editrights           1.01-1             OK
fileutils            4.1-2              OK
findutils            4.1.7-4            OK
flex                 2.5.4a-3           OK
gawk                 3.1.3-4            OK
gcc                  3.3.1-3            OK
gcc-g++              3.3.1-3            OK
gcc-mingw            20030911-4         OK
gcc-mingw-core       20031020-1         OK
gcc-mingw-g++        20031020-1         OK
gdbm                 1.8.3-7            OK
gettext              0.12.1-3           OK
gnupg                1.2.2-3            OK
grep                 2.5-1              OK
groff                1.18.1-2           OK
gzip                 1.3.5-1            OK
jpeg                 6b-11              OK
less                 381-1              OK
libbz2_1             1.0.2-5            OK
libdb3.1             3.1.17-2           OK
libdb4.1             4.1.25-1           OK
libgdbm              1.8.0-5            OK
libgdbm-devel        1.8.3-7            OK
libgdbm3             1.8.3-3            OK
libgdbm4             1.8.3-7            OK
libgettextpo0        0.12.1-3           OK
libiconv2            1.9.1-3            OK
libintl              0.10.38-3          OK
libintl1             0.10.40-1          OK
libintl2             0.12.1-3           OK
libjpeg62            6b-11              OK
libjpeg6b            6b-8               OK
libncurses5          5.2-1              OK
libncurses6          5.2-8              OK
libncurses7          5.3-4              OK
libpcre              4.1-1              OK
libpcre0             4.4-2              OK
libpng12             1.2.5-4            OK
libpopt0             1.6.4-4            OK
libreadline4         4.1-2              OK
libreadline5         4.3-5              OK
libtiff3             3.6.0-2            OK
libtiff4             3.6.0-5            OK
libxml2              2.5.11-1           OK
libxslt              1.0.33-1           OK
login                1.9-7              OK
m4                   1.4-1              OK
make                 3.80-1             OK
man                  1.5j-2             OK
mingw-runtime        3.2-1              OK
mktemp               1.5-3              OK
ncurses              5.3-4              OK
newlib-man           20020801           OK
openssh              3.7.1p2-2          OK
openssl              0.9.7c-1           OK
openssl096           0.9.6j-1           OK
patch                2.5.8-8            OK
pcre                 4.4-2              OK
pcre-doc             4.4-2              OK
perl                 5.8.2-1            OK
pkgconfig            0.15.0-4           OK
readline             4.3-5              OK
rxvt                 2.7.10-3           OK
sed                  4.0.8-1            OK
sh-utils             2.0.15-4           OK
tar                  1.13.25-5          OK
termcap              20021106-2         OK
terminfo             5.3_20030726-1     OK
texinfo              4.2-4              OK
textutils            2.0.21-1           OK
vim                  6.2.098-1          OK
w32api               2.4-1              OK
wget                 1.9.1-1            OK
which                1.5-2              OK
whois                4.6.7-1            OK
xmlto                0.0.17-1           OK
xpm-nox              4.2.0-4            OK
zlib                 1.1.4-4            OK

-- 
Dean



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list