I have class Base with method const char** run, defined with no contents, and I have class Derived with method const char** run. I have the following code:
class Base { // in 'base.h'
public:
const char** run();
};
class Derived : public Base { // in 'derived.h'
public:
const char** run();
};
const char** Wsiv::run(){ // in 'derived.cpp'
return something;
};
// IN 'main.cpp':
map<string, unique_ptr<Base>> modules;
modules["drvd"] = (unique_ptr<Base>(new Derived()));
// A little bit later...
string command = argv[1];
result = (*modules[command].get()).run();
Instead of executing the run() function and storing the const char**
output to 'result', the program does not eve compile, and mingw g++ gives me this error:
C:/Users/bob/AppData/Local/Temp/ccc0cwsT.o:main.cpp:(.text+0x4ee): Undefined reference to 'Base::run()'
collect2.exe: error: ld returned 1 exit status
My compile command is as follows:
g++ ../src/*.cpp -o test -std=c++11