Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 23 Jul 2003 15:44:22 -0400 From: Robert Deschambault Subject: Cannot link C++ code under gcc 3.2 running cygwin under Windows 2000 To: cygwin AT cygwin DOT com Message-id: <00c301c35152$d1634d60$840cc00a@d0106046> Organization: COM DEV MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT X-Priority: 3 X-MSMail-priority: Normal Hello, I have tried to find what my problem is by reading numerous lists, but I haven't managed to figure out exactly what is going on. I suspect I have a problem with either an incorrect library location or something similar. I can compile straight C code and produce a working executable file with no problems. However, when I try to compile a trivial C++ code, I get the following message: $ gcc -v -o hello2 hello.cpp Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs Configured with: /netrel/src/gcc-3.2-3/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc -cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin Thread model: posix gcc version 3.2 20020927 (prerelease) /usr/lib/gcc-lib/i686-pc-cygwin/3.2/cc1plus.exe -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -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__tune_pentium2__ -D__tune_pentium3__ -D__stdcall=__attribute__((__stdcall__)) -D__fastcall=__attribute__((__fastcall__)) -D__cdecl=__attribute__((__cdecl__)) -D_stdcall=__attribute__((__stdcall__)) -D_fastcall=__attribute__((__fastcall__)) -D_cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D__i386 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../include/w32api -isystem /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../i686-pc-cygwin/lib/../../inc lude/w32api hello.cpp -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet -dumpbase hello.cpp -version -o /cygdrive/c/temp/cc9VGI9j.s GNU CPP version 3.2 20020927 (prerelease) (cpplib) (80386, BSD syntax) GNU C++ version 3.2 20020927 (prerelease) (i686-pc-cygwin) compiled by GNU C version 3.2 20020927 (prerelease). ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/i686-pc-cygwin/include" ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api" ignoring duplicate directory "/usr/include/c++/3.2" #include "..." search starts here: #include <...> search starts here: /usr/include/w32api /usr/include/c++/3.2 /usr/include/c++/3.2/i686-pc-cygwin /usr/include/c++/3.2/backward /usr/lib/gcc-lib/i686-pc-cygwin/3.2/include /usr/include End of search list. /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../i686-pc-cygwin/bin/as.exe -- traditional-format -o /cygdrive/c/temp/ccLAocAi.o /cygdrive/c/temp/cc9VGI9j.s /usr/lib/gcc-lib/i686-pc-cygwin/3.2/collect2.exe -Bdynamic --dll-search-pref ix=cyg -o hello2.exe /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../crt0.o /usr/lib/gcc-lib/i686-pc-cygwin/3.2/crtbegin.o -L/usr/lib/gcc-lib/i686-pc-cy gwin/3.2 -L/usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../.. /cygdrive/c/temp/ccLAocAi.o -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -l shell32 -lgcc /usr/lib/gcc-lib/i686-pc-cygwin/3.2/crtend.o /cygdrive/c/temp/ccLAocAi.o(.text+0x29):hello.cpp: undefined reference to `std::cout' /cygdrive/c/temp/ccLAocAi.o(.text+0x36):hello.cpp: undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)' /cygdrive/c/temp/ccLAocAi.o(.text+0x41):hello.cpp: undefined reference to `std::basic_ostream >& std::endl >(std::basic_ostream >&)' /cygdrive/c/temp/ccLAocAi.o(.text+0x46):hello.cpp: undefined reference to `std::basic_ostream >::operator<<(std::basic_ostream >& (*)(std::basic_ostream>&))' /cygdrive/c/temp/ccLAocAi.o(.text+0x6f):hello.cpp: undefined reference to `std::ios_base::Init::Init[in-charge]()' /cygdrive/c/temp/ccLAocAi.o(.text+0x8a):hello.cpp: undefined reference to `std::ios_base::Init::~Init [in-charge]()' /cygdrive/c/temp/ccLAocAi.o(.eh_frame+0x11):hello.cpp: undefined reference to `___gxx_personality_v0' collect2: ld returned 1 exit status -------------------------------- Any insights would be greatly appreciated. Thanks. Bob --- Robert Deschambault COM DEV, 155 Sheldon Drive, Cambridge, Ontario, Canada N1R 7H6 Voice: 519 622 2300, x2461, Fax: 519 622 5843 -- 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/