我的英語很差,所以我很感激你是否試圖理解我的問題。
Boost.Python在Visual Studio 2008中的鏈接器錯誤
我已經Python3.3,升壓1.50.0和Visual Studio 2008的安裝,並且他們都做工精細。
現在我想通過使用Boost Python庫在C++中嵌入python 2.7.6,所以我下載了Portable Python 2.7.6.1(來自portablepython.com/)。
我下載了Boost庫。再次將它們提取到另一個路徑中,按照構建教程進行編譯。
一切似乎都沒錯,但是當我試圖編譯我的代碼時,出現鏈接器錯誤。
Error LNK1104 cannot open file 'python32.lib'
我不知道爲什麼它不是「python27.lib」
我很困惑,因爲我從來沒有安裝Python3.2,我已經修改了用戶config.jam中,以確保所有路徑已被重定向到我的Portable Python(2.7)文件夾,並且新的Boost庫成功構建而沒有錯誤。
我一直在努力解決這個問題了幾個星期,大量應用的方式,但它仍然無法正常工作
我所做的事情是:
下載升壓C++庫(boost_1_50_0.7z從www.boost.org/users/history/version_1_50_0.html)
其解壓縮到我的升壓根路徑(d:\ PROJ \ ThirdPartyLib \ boost_1_50_0)
下載便攜式的Python 2.7.6.1(從portablepython.com/wiki/PortablePython2.7.6。1 /)
其解壓縮到d:\ Py27Test
修改
user-config.jam
,添加下面的文本,並將其保存到d:\ PROJ \ ThirdPartyLib \ boost_1_50_0 \
using python : 2.7 : "D:\Py27Test\App" : "D:\Py27Test\App\include" : "D:\Py27Test\App\libs" : ;
執行Visual Studio命令提示符(x86)
cd /D D:\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
調試infomations是:
notice: [python-cfg] Configuring python...
notice: [python-cfg] user-specified version: "2.7"
notice: [python-cfg] Checking interpreter command "python"...
3210
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"
埃克可愛的Visual Studio 2008
- 添加d:\ PROJ \ ThirdPartyLib \ boost_1_50_0編譯器包含路徑
- 添加d:\ PROJ \ ThirdPartyLib \ boost_1_50_0 \臺\ lib中到鏈接庫路徑
創建一個測試代碼:
#define BOOST_PYTHON_STATIC_LIB #include <boost/python.hpp> #include <iostream> int main(int argc, char** argv) { return 0; }
- Complie代碼和我會得到一個鏈接器錯誤(錯誤LNK1104不能打開文件 'python32.lib')
沒有符合我想念什麼?
還是有沒有人有任何想法來解決這個問題?
預先感謝
感謝您的通知。是的,但我不知道在哪裏可以找到.lib文件。我試圖將Python27.lib重命名爲Python32.lib,但它不起作用(在運行時崩潰)。 我搜索了名稱「Python32.lib」,但我找不到有關32位庫的有用信息。 – 2014-11-24 14:53:25