Xref: news2.mv.net comp.os.msdos.djgpp:1459 Newsgroups: comp.os.msdos.djgpp From: wg491 AT freenet DOT Victoria DOT BC DOT CA (Jerry Lee) Subject: problem linking C++ program with C++ exception Message-ID: <1996Feb25.235243.12623@freenet.victoria.bc.ca> Sender: news AT freenet DOT victoria DOT bc DOT ca (News Manager) Organization: Victoria Freenet Association Date: Sun, 25 Feb 1996 23:52:43 GMT Lines: 50 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hi, Do anybody have trouble linking C++ program that uses the C++ exception mechanism? The following program won't link and the linker produces the theses error messages: undefined reference to terminate(void); undefined reference to unexpected(void); // this prog was taken from C++ FAQ book #include void fred() throw(const char*) { cout << "fred() throwing\n"; throw "barney"; } class X { public: ~X() throw(); }; X::~X() throw() { try { fred(); } catch (const char *msg) { cout << "handling fred()'s exception: " << msg << '\n'; } } int main() { try { X x; cout << "main() throwing\n"; throw "main"; } catch (const char* msg) { cout << "handling main()'s exception: " << msg << '\n'; } return 0; } here is the command line that I use: gcc -fhandle-exceptions t.cc -lgpp --