Linking my program produces a bunch of errors like below.
/home/starlon/Projects/LCDControl/DrvQt.cpp:8: undefined reference to `Generic<LCDText>::Generic(Json::Value*, int)'
/home/starlon/Projects/LCDControl/DrvQt.cpp:18: undefined reference to `Generic<LCDText>::~Generic()'
/home/starlon/Projects/LCDControl/DrvQt.cpp:8: undefined reference to `Generic<LCDText>::Generic(Json::Value*, int)'
/home/starlon/Projects/LCDControl/DrvQt.cpp:18: undefined reference to `Generic<LCDText>::~Generic()'
DrvQt.o: In function `~DrvQt':
/home/starlon/Projects/LCDControl/DrvQt.cpp:23: undefined reference to `Generic<LCDText>::~Generic()'
/home/starlon/Projects/LCDControl/DrvQt.cpp:23: undefined reference to `Generic<LCDText>::~Generic()'
/home/starlon/Projects/LCDControl/DrvQt.cpp:23: undefined reference to `Generic<LCDText>::~Generic()'
/home/starlon/Projects/LCDControl/DrvQt.cpp:23: undefined reference to `Generic<LCDText>::~Generic()'
DrvQt.o:(.rodata._ZTV5DrvQt[vtable for DrvQt]+0xc): undefined reference to `Generic<LCDText>::CFG_Key()'
DrvQt.o:(.rodata._ZTC5DrvQt0_7GenericI7LCDTextE[vtable for DrvQt]+0xc): undefined reference to `Generic<LCDText>::CFG_Key()'
Does that mean I have to have a Generic::MethodName (and Generic::MethodName) for every template parameter I'm going to use? I hope not. I was under the impression that templates were supposed to avoid that sort of scenario.
Edit: Here's DrvQt.cpp
#include <iostream>
#include <QMainWindow>
#include "LCDControl.h"
#include "DrvQt.h"
DrvQt::DrvQt(LCDControl *visitor, Json::Value *config, int rows, int cols) :
Generic<LCDText>(config, LCD_TEXT) { // line 8
display_ = new QtDisplay((Generic<LCDText> *)this,
config, rows, cols, 8, 6);
lcd_ = (LCDText *)display_;
std::cout << "DrvQt" << std::endl;
visitor_ = visitor;
std::cout << "Eval: " << Eval("uptime.Uptime('%H')").toString().toStdString() << std::endl;
std::cout << "Eval: " << Eval("cpuinfo.Cpuinfo('model name')").toString().toStdString() << std::endl;
std::cout << "Eval: " << Eval("foo").toString().toStdString() << std::endl;
std::cout << "Eval: " << Eval("name").toString().toStdString() << std::endl;
} // line 18
DrvQt::~DrvQt() {
delete display_;
//delete window;
} // line 23