Date: Sat, 22 Feb 1997 22:02:16 -0500 (EST) From: Michael Phelps To: John Beppu cc: djgpp AT delorie DOT com Subject: Re: [Q] why would this error occur? undefined reference to terminate(void) In-Reply-To: <5eo3ok$5oq@news.service.uci.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 23 Feb 1997, John Beppu wrote: > > > I tried to use exception handling in C++ for the first time, and > I'm wondering if this may have something to do with these errors. > If someone could tell me how I could get rid of these errors, > please reply. Thanks > > > > gcc -O2 -lgpp -lm -fhandle-exceptions -fomit-frame-pointer -fforce-mem -fforce-addr main.o subst.o -o main Try linking in the libraries at the end of the command line: gcc -O2 -fhandle-exceptions -fomit-frame-pointer -fforce-addr main.o subst.o -o main -lgpp -lm The order (and existance!) of libraries for linking is usually the reason for underfined reference errors. > main.cc(.text+0x3cb): undefined reference to `terminate(void)' > main.cc(.text+0x631): undefined reference to `terminate(void)' > subst.cc(.text+0xcb7): undefined reference to `terminate(void)' > subst.cc(.text+0x1701): undefined reference to `terminate(void)' > make.exe: *** [main] Error 1 > > > -- > beppu AT uci DOT edu ............................................................. > ---Michael Phelps morphine AT cs DOT jhu DOT edu CH3 | N / | ______/ | / \ CH2 _____/ \__|__ // \\ / | \\ // \\______/___CH2 \\ \ / \ / \______/ \_____/ / ------ \ / \ OH \ / OH O Morphine