My english is very poor, so I appreciate if you try to understand my question.
I have Python3.3 , Boost 1.50.0 and visual studio 2008 installed, and all of them work fine.
Now I want to embed python 2.7.6 in C++ by using Boost Python library,so I downloaded Portable Python 2.7.6.1 ( from portablepython.com/).
And I downloaded Boost lib. 1.50.0 again, extract them into another path, compiled them by following the building tutorial.
Everything seem alright, but when I tried to compile my code, I got a linker error.
Error LNK1104 cannot open file 'python32.lib'
I have no idea why it was not 'python27.lib'
I am confused, because I never install Python3.2, and I have modified user-config.jam to make sure that all paths has been redirect to my Portable Python(2.7) folders,and the new Boost library were successfully built without error.
I have been trying to solve the problem for a few weeks, using lots of ways , but it still doesn't work
All the things I have done are :
Download Boost C++ library (boost_1_50_0.7z from www.boost.org/users/history/version_1_50_0.html)
Extract them into my boost root path( D:\\Proj\\ThirdPartyLib\\boost_1_50_0 )
Download Portable Python 2.7.6.1 ( from portablepython.com/wiki/PortablePython2.7.6.1/ )
Extract them into D:\\Py27Test
Modify user-config.jam
, add the following text and save it into D:\\Proj\\ThirdPartyLib\\boost_1_50_0\\
using python : 2.7 : "D:\\Py27Test\\App" : "D:\\Py27Test\\App\\include" : "D:\\Py27Test\\App\\libs" : ;
Execute Visual Studio Command Prompt (x86)
cd /DD:\\Proj\\ThirdPartyLib\\boost_1_50_0
bootstrap
bjam --toolset=msvc-9.0 --python=2.7 --user-config=D:\\Proj\\ThirdPartyLib\\boost_1_50_0\\user-config.jam --debug-configuration
notice: [python-cfg] Configuring python...
notice: [python-cfg] user-specified version: "2.7"
notice: [python-cfg] Checking interpreter command "python"...
notice: [python-cfg] running command 'DIR /-C /A:S "D:\\Py27Test\\App\\python.exe" 2>&1'
notice: [python-cfg] running command '"python" -c "from sys import *; print('version=%d.%d\\nplatform=%s\\nprefix=%s\\nexec_prefix=%s\\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg] interpreter command: "python"
notice: [python-cfg] include path: "D:\\Py27Test\\App\\include"
notice: [python-cfg] library path: "D:\\Py27Test\\App\\libs"
notice: [python-cfg] DLL search path: "D:\\Py27Test\\App"
Execute Visual Studio 2008
create a testing code:
#define BOOST_PYTHON_STATIC_LIB #include <boost/python.hpp> #include <iostream> int main(int argc, char** argv) { return 0; }
Did I miss something?
Or does anyone has any idea to solve this problem?
Thanks in advance
Finally, I solved this problem.
Seems like if I don't include Python.h, it will link to a default library file. So after I added those paths, it works now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.