Re: A linking error I don't understand



On 19/07/2013 00:30, Incongruous ... wrote:
I am using Visual Studio 2010 32bit to compile a program using gtkmm32 and in VS2012 I am using gtkmm64, I have no problem compiling and running under 32 bit, but in the 64 bit I get this linking error:
 
1>contactframe.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) protected:
class std::_List_iterator<class std::_List_val<struct std::_List_simple_types
<class sigc::slot_base> > > __cdecl sigc::signal_base::connect(
class sigc::slot_base const &)"
(__imp_?connect signal_base@sigc@@IEAA?AV?$_List_iterator V?$_List_val@U?
$_List_simple_types Vslot_base@sigc@@@std@@@std@@@std@@AEBVslot_base 2@@Z) referenced in function
 "public: struct sigc::slot_iterator<class sigc::slot
<void,struct sigc::nil,struct sigc::nil,struct sigc::nil,
struct sigc::nil,struct sigc::nil,struct sigc::nil,struct sigc::nil> >
 __cdecl sigc::signal0<void,struct sigc::nil>::connect(
class sigc::slot<void,struct sigc::nil,struct sigc::nil,
struct sigc::nil,struct sigc::nil,struct sigc::nil,struct
sigc::nil,struct sigc::nil> const &)"
(?connect ?$signal0@XUnil sigc@@@sigc@@QEAA?AU?$slot_iterator V?$slot@XUnil sigc@@U12 U12@U12 U12@U12 U12@@sigc@@@2 AEBV?$slot@XUnil sigc@@U12 U12@U12 U12@U12 U12@@2@@Z)
 
What am I doing wrong?


A few things spring to mind.  Firstly, I'll assume that you're linking to libsigc++ which is in a separate DLL.  Have you built all three components with the same compiler (i.e. your app, gtkmm and sigc++)?  In other words, you're not building (say) gtkmm and your app with VS2012 but then trying to link to sigc++ built with VS2010.  Whether you have or you haven't, the following paragraph will almost certainly explain your problem:-

All 3 projects MUST have compatible compiler settings.  An encoding like std@@AEBVslot_base 2@@Z can get subtlely changed by incompatible build settings.  Examine your sigc++ dll in a hex editor.   I'll bet that you can't find an instance of 'slot_base' with precisely that signature.  There'll be something similar but not exactly the same.  That's a pretty good indicator that you've got mismatched build settings.  In fact, even your preprocessor directives can be important here.  I remember getting the same problem once by using a particular preprocessor directive in my app but not setting it the same in my DLL.  I can't remember precisely which directive it was but I think it was either _SECURE_SCL or HAS_ITERATOR_DEBUGGING.  You can't have them turned on in one module and turned off in another.

If that doesn't help either, it's possible (though very unlikely) that you're trying to export an uninstantiated STL class from your DLL.  This KB article describes the problem but I don't think it'll be relevant in your case.

http://support.microsoft.com/kb/168958

Good luck with it.!

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]