我正在尝试将python与C++进行接口。我正在使用2012。我还有一个经过深思熟虑的python2.7发行版。当我试图用以下代码在Win 32上构建一个发行版时:
#include "stdafx.h"
#include "C:/Python27/include/Python.h"
#include "C:/Python27/Lib/site-packages/numpy/core/include/numpy/arrayobject.h"
using namespace std;
int main( int argc, char* argv[] )
{
int x = 1;
PyObject *mod1;
Py_Initialize();
return 0;
}我得到以下错误:
Error 1 error LNK2001: unresolved external symbol __imp__Py_Initialize请帮助,任何更多的想法欢迎。
发布于 2013-09-13 05:50:34
应该将C:\Python27\libs添加到库路径中,并将python27.lib添加到依赖项中。
为此:
Go to project properties -> Configuration properties -> Linker.
Go to ->General and set the "Additional Library directories"在这个字段中添加C:\Python27\libs。
之后:
Go to Linker -> Input and set the "Additional Dependencies"在这个字段中添加python27.lib。
此外,还应该将C:\Python27\include添加到包含目录中,只需:
#include <Python.h>发布于 2013-09-13 06:04:21
我认为您试图将64位python库链接到32位应用程序。
https://stackoverflow.com/questions/18779104
复制相似问题