I want to write a program in C++ with separate compilation and I wrote this:
main.cpp
#include
#include \"Stack.h\"
using namespace
Template classes need to have the method definitions inside the header file.
Move the code you have in the .cpp
file inside the header, or create a file called .impl
or .imp
, move the code there, and include it in the header.
The compiler needs to know the method definitions to generate code for all specializations.
Before you ask, no, there is no way to keep the implementation outside the header.