From: foggy AT flashnet DOT removethis DOT it (Fogbank) Newsgroups: comp.os.msdos.djgpp Subject: Re: gxx and rhide Date: Fri, 08 Jan 1999 13:23:45 GMT Organization: Customer of Flashnet S.p.A. - http://www.flashnet.it Lines: 139 Message-ID: <3695ff77.14144009@news.flashnet.it> References: NNTP-Posting-Host: ppp-12.bo.flashnet.it X-Trace: news.flashnet.it 915801455 12181 194.247.164.92 (8 Jan 1999 13:17:35 GMT) X-Complaints-To: abuse AT flashnet DOT it NNTP-Posting-Date: 8 Jan 1999 13:17:35 GMT X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 31 Dec 1998 10:02:01 +0200 (IST), Eli Zaretskii wrote: >> I'm using GCC 2.8.1 and I found that, while gxx supports exceptions, >> gcc doesn't (and I also have to add -lstdcxx). Is this true? >This cannot possibly be true. Both gcc and gxx are just drivers; the >actual compiler (which supports exceptions) is cc1plus.exe, and it >should be invoked by either gcc or gxx to compile C++ programs. I know, that's why I find it strange. >The most probable cause of your trouble is some installation snafu. >For example, you might be mixing executables from different GCC >versions. Add -v to the compilation/link command switches, and watch >the versions printed by all compiler passes. I'll try to include every detail now... This is exc.cc, an exception testing program: ----------------------------------------------------------------- #include #include int main() { string s = "test"; try { cout << s.substr(5,2); //this should throw an exception } catch(...) { cout << "exxxception!!"; } } ----------------------------------------------------------------- Here is the compiler's output for the command "gcc exc.cc -v -lstdcxx": ----------------------------------------------------------------- d:/djgpp/lib/gcc-lib/djgpp\2.81\cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=8 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=1 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=1 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=1 -D__EXCEPTIONS exc.cc d:/djgpp/tmp\ccaqrk4g GNU CPP version 2.8.1 (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: d:/djgpp/lang/cxx d:/djgpp/include d:/djgpp/lang/cxx d:/djgpp/lib/gcc-lib/djgpp/2.81/include d:/djgpp/include End of search list. d:/djgpp/lib/gcc-lib/djgpp\2.81\cc1plus.exe d:/djgpp/tmp\ccaqrk4g -quiet -dumpb ase exc.cc -version -o d:/djgpp/tmp\ccbqrk4g GNU C++ version 2.8.1 (djgpp) compiled by GNU C version 2.8.1. d:/djgpp/bin/as.exe -o d:/djgpp/tmp\cccqrk4g d:/djgpp/tmp\ccbqrk4g d:/djgpp/bin/ld.exe d:/djgpp/lib/crt0.o -Ld:/djgpp/lib -Ld:/djgpp/lib/gcc-lib/djgpp\2.81 -Ld:/djgpp/bin -Ld:/djgpp/lib d:/djgpp/tmp\cccqrk4g -lstdcxx -Tdjgpp.djl -lgcc -lc -lgcc d:/djgpp/bin/stubify.exe -v a.out stubify for djgpp V2.X executables, Copyright (C) 1995 DJ Delorie stubify: a.out -> a.exe ----------------------------------------------------------------- As you can see, the only version mentioned is 2.8.1. This is the program's output: ----------------------------------------------------------------- > a.exe Abort! > ----------------------------------------------------------------- So, the exception seems to be caught by the compiler, not by my handler. This is the compiler's output for "gxx exc.cc -v": ----------------------------------------------------------------- Reading specs from d:/djgpp/lib/gcc-lib/djgpp/2.81/specs gcc version 2.8.1 d:/djgpp/lib/gcc-lib/djgpp/2.81/cpp.exe -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=8 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=1 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=1 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=1 -D__EXCEPTIONS exc.cc d:/djgpp/tmp\ccaqjxah GNU CPP version 2.8.1 (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: d:/djgpp/lang/cxx d:/djgpp/include d:/djgpp/lang/cxx d:/djgpp/lib/gcc-lib/djgpp/2.81/include d:/djgpp/include End of search list. d:/djgpp/lib/gcc-lib/djgpp/2.81/cc1plus.exe d:/djgpp/tmp\ccaqjxah -quiet -dumpb ase exc.cc -version -o d:/djgpp/tmp\ccbqjxah GNU C++ version 2.8.1 (djgpp) compiled by GNU C version 2.8.1. d:/djgpp/bin/as.exe -o d:/djgpp/tmp\cccqjxah d:/djgpp/tmp\ccbqjxah d:/djgpp/bin/ld.exe d:/djgpp/lib/gcc-lib/djgpp/2.81/crtf.o d:/djgpp/lib/crt0.o -Ld:/djgpp/lib/gcc-lib/djgpp/2.81 -Ld:/djgpp/bin -Ld:/djgpp/lib d:/djgpp/tmp\cccqjxah -lstdcxx -lm -lgcc -lc -lgcc -Tdjgpp.djl d:/djgpp/bin/stubify.exe -v a.out stubify for djgpp V2.X executables, Copyright (C) 1995 DJ Delorie stubify: a.out -> a.000 -> a.exe ----------------------------------------------------------------- As you can see, the linker is called with different options (but, according to the faq, this is normal). And now, this is the program's output: ----------------------------------------------------------------- > a.exe exxxception!! > ----------------------------------------------------------------- So now my handler catches the exception. Why this behaviour? What do I do wrong? Ciao, Foggy (foggy(at)flashnet.it) "Windows 95: 32 bit extension and graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor"