Compile boost python extension using IDE on windows

Hi guys, I have a extension on Linux that uses boost python with no problems. Now I want to compile my extension on Windows, so I downloaded the precompiled boost libraries from: http://www.boostpro.com/download/boost_1_44_setup.exe I tried to compile my extension on windows using Visual Studio c++ 2008 express edition. I followed all the instructions from: http://boost.cppll.jp/HEAD/libs/python/doc/building.html to use an IDE to compile my own project and obtain a dll. I included all sources and libs and turned on RTTI and changed the debug and release builds to Multi-thread dll debug and Multi-thread dll release. All compilation process is successful. The problem is during linking appears *some warnings as*: 1> Creating library C:\My Dropbox\codes\fem\pyfem\Debug\pyfem.lib and object C:\My Dropbox\codes\fem\pyfem\Debug\pyfem.exp 1>libfembase.obj : warning LNK4217: locally defined symbol ??0str_base@detail@python@boost@@IAE@PBD@Z (protected: __thiscall boost::python::detail::str_base::str_base(char const *)) imported in function "public: __thiscall boost::python::str::str(char const *)" (??0str@python@boost@@QAE@PBD@Z) 1>libfembase.obj : warning LNK4217: locally defined symbol ?? 1str_base@detail@python@boost@@QAE@XZ (public: __thiscall boost::python::detail::str_base::~str_base(void)) imported in function "public: __thiscall boost::python::str::~str(void)" (??1str@python@boost@ @QAE@XZ) 1>libfembase.obj : warning LNK4217: locally defined symbol ?throw_error_already_set@python@boost@@YAXXZ (void __cdecl boost::python::throw_error_already_set(void)) imported in function "int __cdecl boost::python::len(class boost::python::api::object const &)" (?len@python@boost@@YAHABVobject@api@12@@Z) *and some errors as:* 1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved external symbol __imp__PyDict_Items referenced in function "public: class boost::python::list __thiscall boost::python::detail::dict_base::items(void)const " (?items@dict_base @detail@python@boost@@QBE?AVlist@34@XZ) 1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved external symbol __imp__PyDict_Keys referenced in function "public: class boost::python::list __thiscall boost::python::detail::dict_base::keys(void)const " (?keys@dict_base @detail@python@boost@@QBE?AVlist@34@XZ) 1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved external symbol __imp__PyDict_Update referenced in function "public: void __thiscall boost::python::detail::dict_base::update(class boost::python::api::object const &)" (?update@dict_base@detail@python@boost@ @QAEXABVobject@api@34@@Z) 1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved external symbol __imp__PyDict_Values referenced in function "public: class boost::python::list __thiscall boost::python::detail::dict_base::values(void)const " (?values@dict_base @detail@python@boost@@QBE?AVlist@34@XZ) 1>C:\My Dropbox\codes\fem\pyfem\Debug\pyfem.dll : fatal error LNK1120: 133 unresolved externals 1>Build log was saved at "file://c:\My Dropbox\codes\fem\pyfem\Debug\BuildLog.htm" 1>pyfem - 230 error(s), 56 warning(s) *#############* I got the same warnings and errors using bjam. I have been successful compiling and linking as a static library pyfem.lib using VS, but it does not work as a python extension even renaming to .pyd. - What I am missing to obtain the dll for my extension using VS? - Is it possible to create a boost python extension using VS C++ 2008 express edition? - I am using Win7 64 bits and Python 2.6 64 bits, so using boost 64 bit binaries is mandatory? Thanks. Raul Durand

At Wed, 12 Jan 2011 11:15:20 -0200, Raul Durand wrote:
Hi guys,
I have a extension on Linux that uses boost python with no problems. Now I want to compile my extension on Windows, so I downloaded the precompiled boost libraries from: http://www.boostpro.com/download/boost_1_44_setup.exe
I tried to compile my extension on windows using Visual Studio c++ 2008 express edition.
I followed all the instructions from: http://boost.cppll.jp/HEAD/libs/python/doc/building.html to use an IDE to compile my own project and obtain a dll.
I suggest you only use instructions from www.boost.org; I don't know anything about that site.
I included all sources and libs and turned on RTTI and changed the debug and release builds to Multi-thread dll debug and Multi-thread dll release.
Have you tried to use bjam as described in http://www.boost.org/doc/libs/1_45_0/libs/python/doc/tutorial/doc/html/pytho... (and did you read everything in the NOTE at the top of the page?) -Dave -- Dave Abrahams BoostPro Computing http://www.boostpro.com
participants (2)
-
Dave Abrahams
-
Raul Durand