Undefined symbols “vtable for …” and “typeinfo for…”?

If Obstacle is an abstract base class, then make sure you declare all its virtual methods “pure virtual”: virtual void Method() = 0; The = 0 tells the compiler that this method must be overridden by a derived class, and might not have its own implementation. If the class contains any non-pure virtual functions, then … Read more

Undefined reference to sqrt (or other mathematical functions)

You may find that you have to link with the math libraries on whatever system you’re using, something like: gcc -o myprog myprog.c -L/path/to/libs -lm ^^^ – this bit here. Including headers lets a compiler know about function declarations but it does not necessarily automatically link to the code required to perform that function. Failing … Read more

What is an undefined reference/unresolved external symbol error and how do I fix it in Fortran?

A link-time error like these messages can be for many of the same reasons as for more general uses of the linker, rather than just having compiled a Fortran program. Some of these are covered in the linked question about C++ linking and in another answer here: failing to specify the library, or providing them … Read more

What is an undefined reference/unresolved external symbol error and how do I fix it?

Compiling a C++ program takes place in several steps, as specified by 2.2 (credits to Keith Thompson for the reference): The precedence among the syntax rules of translation is specified by the following phases [see footnote]. Physical source file characters are mapped, in an implementation-defined manner, to the basic source character set (introducing new-line characters … Read more