terminate defined in the C ++ standard library, so make sure you link this. Assuming you are using gcc to compile, you should use the g++ executable to compile the source code, not the gcc executable:
g++ source.cc -o output
When executed as g++ , the linker is automatically linked in the C ++ standard library (libstdc ++) for you. If, instead of gcc, you run the plain gcc command or you directly call the ld linker, you need to add -lstdc++ yourself to communicate in the library, for example:
gcc source.cc -o output -lstdc++ # Compile directly from source ld source1.o source2.o -o output -lstdc++ # Link together object files
Adam rosenfield
source share