linker-errors
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
Why am I getting “undefined reference to sqrt” error even though I include math.h header? [duplicate]
The math library must be linked in when building the executable. How to do this varies by environment, but in Linux/Unix, just add -lm to the command: gcc test.c -o test -lm The math library is named libm.so, and the -l command option assumes a lib prefix and .a or .so suffix.
Undefined reference to `sin` [duplicate]
You have compiled your code with references to the correct math.h header file, but when you attempted to link it, you forgot the option to include the math library. As a result, you can compile your .o object files, but not build your executable. As Paul has already mentioned add “-lm” to link with the … 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
Qt Linker Error: “undefined reference to vtable” [duplicate]
Any time you add a new call to the Q_OBJECT macro, you need to run qmake again. The vtables issue you’re referring to is directly related to that. Just run qmake and you should be good to go assuming there are no other issues in your code.
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