From: Barry S. <ba...@ba...> - 2015-11-05 20:40:57
|
On Thursday 05 November 2015 18:19:13 Ilçeren Inçelami Çadormoç wrote: > Good afternoon,I've came across this PyCXX project just recently as I was > looking for information on how to make extension modules for Python so I > could hook up some C++ code to a Python back-end. I've used the > "example.cxx" file heavily for reference in order to code the interface > with Python using an ExtensionModule, added the path to the installation > folder for the header inclusion, included the necessary headers at the > start of my code and added the three PyCXX code files required for > extension programming to my sources directory. The thing is, even then, I > get a bunch of unresolved external symbols when I try to compile my program > to a DLL file. I'm using Visual Studio 2010. I don't think I've forgotten > anything, not after re-reading the installation and module sections of the > documentation a few times. The errors are as follow: > > Error 24 error LNK2001: símbolo externo "void __cdecl Py::_XINCREF(struct > _object *)" (?_XINCREF@Py@@YAXPEAU_object@@@Z) sin > resolver C:\...\cxxsupport.obj Hephestos Hammer Error 21 error LNK2001: > símbolo externo "void __cdecl Py::_XDECREF(struct _object *)" > (?_XDECREF@Py@@YAXPEAU_object@@@Z) sin > resolver C:\...\cxxsupport.obj Hephestos Hammer Error 41 error LNK2001: > símbolo externo "struct _typeobject * __cdecl Py::_Type_Type(void)" > (?_Type_Type@Py@@YAPEAU_typeobject@@XZ) sin > resolver C:\...\cxx_extensions.obj Hephestos Hammer Error 39 error LNK2001: > símbolo externo "struct _object * __cdecl Py::_None(void)" > (?_None@Py@@YAPEAU_object@@XZ) sin > resolver C:\...\cxx_extensions.obj Hephestos Hammer Error 36 error LNK2001: > símbolo externo "struct _object * __cdecl Py::_Exc_TypeError(void)" > (?_Exc_TypeError@Py@@YAPEAU_object@@XZ) sin > resolver C:\...\cxxsupport.obj Hephestos Hammer Error 42 error LNK2001: > símbolo externo "struct _object * __cdecl Py::_Exc_RuntimeError(void)" > (?_Exc_RuntimeError@Py@@YAPEAU_object@@XZ) sin > resolver C:\...\cxx_extensions.obj Hephestos Hammer Error 47 error LNK2001: > símbolo externo "char * __cdecl Py::__Py_PackageContext(void)" > (?__Py_PackageContext@Py@@YAPEADXZ) sin > resolver C:\...\cxx_extensions.obj Hephestos Hammer Error 27 error LNK2001: > símbolo externo "bool __cdecl Py::_Unicode_Check(struct _object *)" > (?_Unicode_Check@Py@@YA_NPEAU_object@@@Z) sin > resolver C:\...\cxxsupport.obj Hephestos Hammer Error 30 error LNK2001: > símbolo externo "bool __cdecl Py::_Type_Check(struct _object *)" > (?_Type_Check@Py@@YA_NPEAU_object@@@Z) sin > resolver C:\...\cxxsupport.obj Hephestos Hammer Error 31 error LNK2001: > símbolo externo "bool __cdecl Py::_String_Check(struct _object *)" > (?_String_Check@Py@@YA_NPEAU_object@@@Z) sin > resolver C:\...\cxxsupport.obj Hephestos Hammer Error 34 error LNK2001: > símbolo externo "bool __cdecl Py::_List_Check(struct _object *)" > (?_List_Check@Py@@YA_NPEAU_object@@@Z) sin > resolver C:\...\cxxsupport.obj Hephestos Hammer Error 48 error LNK2001: > símbolo externo "bool __cdecl Py::_Int_Check(struct _object *)" > (?_Int_Check@Py@@YA_NPEAU_object@@@Z) sin > resolver C:\...\thirdeye.obj Hephestos Hammer Error 46 error LNK2001: > símbolo externo "bool __cdecl Py::_Dict_Check(struct _object *)" > (?_Dict_Check@Py@@YA_NPEAU_object@@@Z) sin > resolver C:\...\cxx_extensions.obj Hephestos Hammer > > The Spanish bits just mean "Unresolved external symbol". I've also skipped > some duplicated errors since I have to copy each one manually and there are > some which are repeated up to three times in different .obj files. I don't > know how to fix them, since I don't find anywhere the functions are > defined. For example, I can track the Py::_XINCREF and Py::_XDECREF errors > to the Objects.hxx file, where those functions are called, but none of the > other files have a definition of said functions, it seems... Am I missing > something? The missing symbols are in IndirectPythonInterface.cxx It is not optional. You can generate a windows make file using the following: c:\python27\python.exe setup_makefile.py win32 example.mak change the path to python to suit your needs. If you have nmake on the path you can then build the examples nmake -f example.make Barry |