Hello, I'm at my wits end. I'm building a C++ application for an embedded device, but I'm having trouble catching exceptions within the embedded environment. The exact same code works fine on my regular desktop environment, with the same version of GCC (4.1.2).
I've been able to boil this down to a single source file and one compile command: g++ -fexceptions -frtti -o program program.cpp Here is my program, the output from each environment, along with the output from 'g++ -v' is below. Thanks for any help you can give, I'm not even sure how to begin diagnosing this further, so any hints would be appreciated. -Josh // BEGIN EXCEPTION TEST #include <iostream> class test { public: test() throw(std::exception); }; test::test() throw(std::exception) { throw std::exception(); } int main() { try { test t; } catch(std::exception e) { std::cout << "caught" << std::endl; } return 0; } // END EXCEPTION TEST Here is what happens when I run from my embedded environment: moya exceptionTest # g++ -fexceptions -frtti -o program program.cpp moya exceptionTest # ./program terminate called after throwing an instance of 'std::exception' terminate called recursively Aborted (core dumped) moya exceptionTest # g++ -v Using built-in specs. Target: i586-gentoo-linux-uclibc Configured with: /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/i586-gentoo-linux-uclibc/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/i586-gentoo-linux-uclibc/4.1.2/include --datadir=/usr/share/gcc-data/i586-gentoo-linux-uclibc/4.1.2 --mandir=/usr/share/gcc-data/i586-gentoo-linux-uclibc/4.1.2/man --infodir=/usr/share/gcc-data/i586-gentoo-linux-uclibc/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/i586-gentoo-linux-uclibc/4.1.2/include/g++-v4 --host=i586-gentoo-linux-uclibc --build=i586-gentoo-linux-uclibc --disable-altivec --disable-nls --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --disable-libmudflap --disable-libssp --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --disable-__cxa_atexit --enable-target-optspace --enable-clocale=uclibc Thread model: posix gcc version 4.1.2 (Gentoo 4.1.2) Here is what happens when I run from my desktop environment: [EMAIL PROTECTED]:~/src/exceptionTest$ g++ -fexceptions -frtti -o program program.cpp [EMAIL PROTECTED]:~/src/exceptionTest$ ./program caught [EMAIL PROTECTED]:~/src/exceptionTest$ g++ -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c ++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)