[Solved] Undefine reference of

The problem is that c++ test.cpp -I./include-core/ -o bin/test -L./bin -l${core_NAME_ROOT}c++ test.cpp -I./include-core/ -o bin/test -L./bin -l${core_NAME_ROOT} will first process the library and then your .cpp file. When processing a library, referenced symbols are resolved (“linked”) and all unresolved symbols in the library that aren’t needed are thrown away. That means that as soon as … Read more

(Solved) Why can templates only be implemented in the header file?

Caveat: It is not necessary to put the implementation in the header file, see the alternative solution at the end of this answer. Anyway, the reason your code is failing is that, when instantiating a template, the compiler creates a new class with the given template argument. For example: template<typename T> struct Foo { T … Read more

(Solved) 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