Hi,
I just ported an app to visual studio 10. The project embeds lua and uses luabind for added facilities. The problem is occurring when trying to link the luabind library with the project.
Here is the error:
Code:
luabind.debug.lib(class_rep.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator+=(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl luabind::detail::get_overload_signatures_candidates(struct lua_State *,class std::_Vector_iterator<struct luabind::detail::overload_rep_base const *,class std::allocator<struct luabind::detail::overload_rep_base const *> >,class std::_Vector_iterator<struct luabind::detail::overload_rep_base const *,class std::allocator<struct luabind::detail::overload_rep_base const *> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?get_overload_signatures_candidates@detail@luabind@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAUlua_State@@V?$_Vector_iterator@PBUoverload_rep_base@detail@luabind@@V?$allocator@PBUoverload_rep_base@detail@luabind@@@std@@@4@1V34@@Z)
According to microsoft: You may receive an LNK2019 error message when you build a Visual C++ 2005 or Visual C++ .NET application that uses a CString-derived class from a DLL file
The resolution is this:
To resolve this issue, explicitly import the template class for CStringT and CSimpleStringT in the precompiled header (stdafx.h) file, as follows:
Code:
template class __declspec(dllimport) CStringT<TCHAR, StrTraitMFC<TCHAR, ChTraitsCRT<TCHAR> > >;
template class __declspec(dllimport) CSimpleStringT<TCHAR>;
But when I try to add that, it gives me compiler errors. Any ideas on how to fix this ?
thanks!