2
我有一個類全局模板C++對象的
class ICIecHdlcSetup
{
//some thing
};
創建一個全局訪問對象我這樣做:
//in obj.cpp:
ICIecHdlcSetup obj_ICIecHdlcSetup(0x00,0x00,0x16,0x00,0x00,0xFF);
//in obj.hpp:
extern ICIecHdlcSetup obj_ICIecHdlcSetup;
現在我有一個模板類:
template <class TValue>
class ICData
{
//some thing
};
但同樣的方式也行不通
//in obj.cpp:
ICData <uint8_t> temperture(7,64,41,0,0,255) ;
//in obj.hpp:
extern ICData <uint8_t> temperture ;
,使這個錯誤:
Error 10 error LNK2019: unresolved external symbol "public: void __thiscall ICData<unsigned char>::set_value(unsigned char)" ([email protected][email protected]@@[email protected]) referenced in function "void __cdecl object_instantiation(void)" ([email protected]@YAXXZ) E:\sv_repos\Test\Test\VS2010\Test\Test\Objects.obj Test
在此先感謝。