Thread: Visual Studio 10 - Luabind - Link Error2019

  1. #1
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285

    Visual Studio 10 - Luabind - Link Error2019

    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!
    Spidey out!

  2. #2
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    What errors?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Since it looks like std:: objects are being used across a DLL boundary (not advisable in general), you will need to re-build the luabind libraries using VS2010 - with the same CRT settings that your app will use.

    gg

  4. #4
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    Yes, that fixed it. Thanks!
    Spidey out!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. multiple errors generated by socket headers
    By nocturna_gr in forum Windows Programming
    Replies: 5
    Last Post: 12-16-2007, 06:33 PM
  2. Problem Compiling Program
    By wco5002 in forum C++ Programming
    Replies: 13
    Last Post: 11-06-2007, 12:56 PM
  3. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  4. header file bringing errors?
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2003, 12:51 PM
  5. Segmentation Fault
    By Lost__Soul in forum C Programming
    Replies: 46
    Last Post: 04-28-2003, 04:24 AM