trouble building python binding in windows <SOLVED>
Posted: Tue Mar 18, 2008 18:15
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
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