I've been having difficulties building the python bindings using VS 8.0. I got the source from SVN and have attempted to compile and link the generated swig file along with the functors and other support code. Everything compiles fine, but when it comes to linking I run into an LNK2001 error (unresolved external symbol "symbol"), for members of the RefCounted template. CEGUI::RefCounted<CEGUI::BoundSlot>::operator * was one. There were several others with a similar pattern. All the things the linker couldn't find were members of the RefCounted template instanced in the support code. And the compiler was expecting all of them to be imported because all of them were prefixed with __declspec(dllimport).
I think I have a good idea of what's going on, but I just don't know how to deal with it. The support code, needed for callbacks and whatnot, uses templates within the cegui dll library. The template, RefCounted, is declared with the __declspec(dllimport), which makes the linker think to look for those templates in an external library. I suspect that the members that it's complaining about are members not instanced during compilation, and are therefore missing during linking. Or maybe the import tag propagated to the instance, and the linker thought it could find the code elsewhere. There is a bug in VS about this that could be related:
"The definition of member template is outside the class. Visual C++ has a limitation in which member templates must be fully defined within the enclosing class. See KB article Q239436 for more information about LNK2001 and member templates."
The KB article suggests some ways to instance the template explicitly in the cpp, but I didn't have any luck with it.
I'm not sure what to do next. I was thinking of bringing in a local version of the RefCounted template without the __declspec(dllimport).
When I get to my home PC, I'll send the exact error messages.
Any ideas would be greatly appreciated. Thanks in advance.
-Greg
trouble building python binding in windows <SOLVED>
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 8
- Joined: Tue Mar 18, 2008 17:39
trouble building python binding in windows <SOLVED>
Last edited by gtmacdonald@gmail.com on Wed Mar 19, 2008 04:11, edited 1 time in total.
-
- Just popping in
- Posts: 8
- Joined: Tue Mar 18, 2008 17:39
I don't think it's a template bug with visual studio anymore. A friend of mine took a look and discovered that the template member "operator *" was declared inside the class, inlined in fact. So more than likely it's that __declimport(dllimport) tag on the template RefCounted that's the problem.
Code: Select all
1>------ Build started: Project: CEGUIPython, Configuration: Release Win32 ------
1>Linking...
1> Creating library C:\CEGUIPython-0.5.0-old\Release\_CEGUIPython.lib and object C:\CEGUIPython-0.5.0-old\Release\_CEGUIPython.exp
1>CEGUIPython.obj : error LNK2001: unresolved external symbol "unsigned char * cegui_py_wrapper" (?cegui_py_wrapper@@3PAEA)
1>CEGUIPython.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: void __thiscall CEGUI::RefCounted<class CEGUI::PythonCallbackWrapper>::addRef(void)" (__imp_?addRef@?$RefCounted@VPythonCallbackWrapper@CEGUI@@@CEGUI@@AAEXXZ)
1>CEGUIPython.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CEGUI::RefCounted<class CEGUI::PythonCallbackWrapper>::~RefCounted<class CEGUI::PythonCallbackWrapper>(void)" (__imp_??1?$RefCounted@VPythonCallbackWrapper@CEGUI@@@CEGUI@@QAE@XZ)
1>CEGUIPython.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CEGUI::RefCounted<class CEGUI::PythonCallbackWrapper>::RefCounted<class CEGUI::PythonCallbackWrapper>(class CEGUI::RefCounted<class CEGUI::PythonCallbackWrapper> const &)" (__imp_??0?$RefCounted@VPythonCallbackWrapper@CEGUI@@@CEGUI@@QAE@ABV01@@Z)
1>CEGUIPython.obj : error LNK2001: unresolved external symbol "unsigned int cegui_py_wrapper_size" (?cegui_py_wrapper_size@@3IA)
1>CEGUIPythonFunctor.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class CEGUI::PythonCallbackWrapper const * __thiscall CEGUI::RefCounted<class CEGUI::PythonCallbackWrapper>::operator->(void)const " (__imp_??C?$RefCounted@VPythonCallbackWrapper@CEGUI@@@CEGUI@@QBEPBVPythonCallbackWrapper@1@XZ)
1>CEGUIPythonFunctor.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CEGUI::RefCounted<class CEGUI::PythonCallbackWrapper>::RefCounted<class CEGUI::PythonCallbackWrapper>(class CEGUI::PythonCallbackWrapper *)" (__imp_??0?$RefCounted@VPythonCallbackWrapper@CEGUI@@@CEGUI@@QAE@PAVPythonCallbackWrapper@1@@Z)
1>python_CEGUI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class CEGUI::BoundSlot const & __thiscall CEGUI::RefCounted<class CEGUI::BoundSlot>::operator*(void)const " (__imp_??D?$RefCounted@VBoundSlot@CEGUI@@@CEGUI@@QBEABVBoundSlot@1@XZ)
1>C:\CEGUIPython-0.5.0-old\Release\_CEGUIPython.pyd : fatal error LNK1120: 8 unresolved externals
1>Build log was saved at "file://c:\CEGUIPython-0.5.0-old\Release\BuildLog.htm"
1>CEGUIPython - 9 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
-
- Just popping in
- Posts: 8
- Joined: Tue Mar 18, 2008 17:39
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 5 guests