python - SWIG fatal error C1083 : Cannot open include file

标签 python c++ swig

我正在尝试使用 SWIG 从 C++ 代码构建 python 脚本,但我收到标题中的错误。如果我更改接口(interface)并完全限定外部头文件的路径,它就可以正常工作。

几个问题:

  1. 路径可以包含在命令调用中吗?我尝试了 -IC:\Code\ExternalHeaders 但没有成功。

  2. 这条路径可以由参数驱动吗?不同的开发者会有不同的路径。这样他们就可以在他们的 project.scons 文件中更改路径,一切都会正常进行。

我们使用 SCONS 构建所有源代码。头文件位于 C:\Code\Edwards\EWCppLibrary\EWBase。这是日志:

C:\Code\Python\QTPythonExample\QETestProject_CLM>scons -f vs.scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... scons: building associated VariantDir targets: build\win32\release build\win32\debug swig -o build\win32\debug\src\py_swig_interface_wrap.cc

-IC:\Code\Edwards\EWCppLibrary -Iinc -Isrc -IEWBase -IC:\Python27\include

-python -c++ -nodefault -templatereduce src\py_swig_interface.i SWIG(1) : Warning 123: dangerous, use -nodefaultctor, -nodefaultdtor instead. cl /Fobuild\win32\debug\src\py_swig_interface_wrap.obj /c build\win32\debug\src\py_swig_interface_wrap.cc /TP /DEBUG /Zi /MDd /Od /EHsc /nologo /D__WIN32__ /DWIN32 /DDEBUG /IC:\Code\Edwards\EWCppLibrary /Iinc /Isrc /IEWBase /IC:\Python27\include /Zi /Fdbuild/w in32/debug\py_swig_interface_wrap.obj.pdb py_swig_interface_wrap.cc build\win32\debug\src\py_swig_interface_wrap.cc(3065) : fatal error C1083: Cannot open include file: 'EWStddef.h': No such file or  directory scons: *** [build\win32\debug\src\py_swig_interface_wrap.obj] Error 2 scons: building terminated because of errors.

C:\Code\Python\QTPythonExample\QETestProject_CLM>

最佳答案

您需要指定:

/IC:\Code\Edwards\EWCppLibrary\EWBase

对于你的编译器。

关于python - SWIG fatal error C1083 : Cannot open include file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26005126/

相关文章:

python - 如何使用 Pandas 按时间序列中的一个或多个维度分组?

c# - 简单地将 OpenMp Parallel for 转换为 c# Parallel for

android - 我如何判断 "inline"是否有效?

perl - 使用 SWIG 将二进制数据移入/移出 Perl

python请求ssl错误550

python - 如何限制同时递归调用2个函数的次数? - Python

python - 从python中的另一个列表获取列表的相应元素时得到错误的列表使用map函数

c# - AccessibleObjectFromPoint 返回客户端对象而不是复选框

python - Swig - 包装 C 结构

java - Typemap javaimports不适用于内部C++类