lundi 4 décembre 2017

C++11 linker error VS17

using namespace std;
template <typename T >
        bool writeFile(string fileName, 
            typename enable_if<is_base_of<ABase, T>::value, T >::type* data);

Definition...

template <typename T >
        bool writeFile(string fileName, 
            typename enable_if<is_base_of<ABase, T>::value, T >::type* data){
       return true;
}

Im still getting error by Linker:

LNK2019 unresolved external symbol "public: bool __thiscall Storage::writeFile(class std::basic_string,class std::allocator >,class AFile*)" (??$writeFile@VAFile@@@Storage@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVAFile@@@Z) referenced in function _main

Why am i getting it if code is looking right. Its generic definition of method in a class and Im trying to constrain class type passing to the method. And the AFile is inherited from ABase.

Simple usage in main:

AFile* afile = new AFile();
s->saveJsonData<AFile>("a.txt", afile);

Aucun commentaire:

Enregistrer un commentaire