class T : public std::string {
public:
T(char* s) : std::string(s){};
};
class X : public T {
public:
X(char* s) : T(s) {};
~X() {};
};
template <typename T> T doIt(const T arg);
int main(int argc, const char* argv[]) {
X s("initial string");
T s2 = doIt(s);
printf("out %s", s2.c_str());
}
T doIt(T arg) {
arg.append(" appended");
return arg;
};
私のコードの問題は何ですか..出力は次のとおりです...
1>Linking...
1>TemplateStuding1.obj : エラー LNK2001: 未解決の外部シンボル "class X __cdecl doIt(class X)" (??$doIt@VXClass@@@@YA?AVXClass@@V0@@Z)
1 >D:\Programming\cpp\cpp-how-to-program\CppHowToProgram\Release\Test.exe: 致命的なエラー LNK1120: 1 つの未解決の外部