unresolved externals for wxWindowList with VS11 (2012) and wxUSE_STD_CONTAINERS
|Reported by:||hajokirchhoff||Owned by:|
|Keywords:||vs11 msvs dll||Cc:|
I'm trying to compile my application with Visual Studio 2012 and get the following unresolved externals from std::list<wxWindow*> when I have wxUSE_STD_CONTAINERS defined:
This and others:
"__declspec(dllimport) public: static struct std::_List_node<class wxWindow *,void *> * & __cdecl std::_List_val<struct std::_List_simple_types<class wxWindow *> >::_Nextnode(struct std::_List_node<class wxWindow *,void *> *)" (__imp_?_Nextnode@?$_List_val@U?$_List_simple_types@PEAVwxWindow@@@std@@@ std@@SAAEAPEAU?$_List_node@PEAVwxWindow@@PEAX@2@PEAU32@@Z) referenced in function "public: class std::_List_const_iterator<class std::_List_val<struct std::_List_simple_types<class wxWindow *> > > & __cdecl std::_List_const_iterator<class std::_List_val<struct std::_List_simple_types<class wxWindow *> > >::operator++(void)" (??E?$_List_const_iterator@V?$_List_val@U?$_List_simple_types@PEAVwxWindow @@@std@@@std@@@std@@QEAAAEAV01@XZ)
Here is what I think happens:
In pre VS11 when an exported class derived from a template, the template instance would in some instances be automatically exported as well. This seems no longer to be the case.
window.h, line 145 (approx) has the following line
WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLIMPEXP_CORE);
This declares a class _dllexport/import wxWindowList, which derives from std::list<wxWindow*> through some macro magic (WX_DECLARE_LIST_XO in list.h, line 147)
The declaration is
class WXDLLIMPEXP_CORE wxWindowList:public std::list<wxWindow*> ...
Pre VS11 (VS9, Visual Studio 2008 to be precise) would seemingly export all std::list members as well. But when I compile this code:
wxWindow *window; for (wxWindowList::iterator i = window->GetChildren().begin(); i != window->GetChildren().end(); ++i)
I get the unresolved externals above.
Any Ideas? The way I see it, we have two choices:
- Make wxWindowList a template itself or a header-only class. It is currently being exported and there is a forward export declaration in utils.h, line 57.
- Explicitly instantiate std::list<wxWindow*> and export it. I think this is possible with a non-standard Microsoft extension. This explicit instantiation and export statement should reside somewhere in the wx-core sources.
Change History (6)
comment:1 Changed 3 years ago by vadz
- Keywords msvs dll added; visual studio removed
- Milestone set to 3.0