SWIG致命错误C1083:无法打开包含文件

SWIG Fatal error C1083: Cannot open include file

本文关键字:包含 文件 致命错误 C1083 SWIG      更新时间:2023-10-16

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

几个问题:

  1. 该路径是否可以包含在命令调用中?我尝试了-IC:CodeExternalHeaders,但没有成功。

  2. 这个路径可以由参数驱动吗?不同的开发人员会有不同的路径。通过这种方式,他们可以在project.scons文件中更改路径,一切都会正常工作。

我们使用SCONS构建所有源代码。头文件位于C:CodeEdwardsEWCppLibraryEWBase中。这是日志:

C:CodePythonQTPythonExampleQETestProject_CLM>scons -f vs.scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... scons: building associated VariantDir targets: buildwin32release buildwin32debug swig -o buildwin32debugsrcpy_swig_interface_wrap.cc
-IC:CodeEdwardsEWCppLibrary -Iinc -Isrc -IEWBase -IC:Python27include
-python -c++ -nodefault -templatereduce srcpy_swig_interface.i SWIG(1) : Warning 123: dangerous, use -nodefaultctor, -nodefaultdtor instead. cl /Fobuildwin32debugsrcpy_swig_interface_wrap.obj /c buildwin32debugsrcpy_swig_interface_wrap.cc /TP /DEBUG /Zi /MDd /Od /EHsc /nologo /D__WIN32__ /DWIN32 /DDEBUG /IC:CodeEdwardsEWCppLibrary /Iinc /Isrc /IEWBase /IC:Python27include /Zi /Fdbuild/w in32/debugpy_swig_interface_wrap.obj.pdb py_swig_interface_wrap.cc buildwin32debugsrcpy_swig_interface_wrap.cc(3065) : fatal error C1083: Cannot open include file: 'EWStddef.h': No such file or  directory scons: *** [buildwin32debugsrcpy_swig_interface_wrap.obj] Error 2 scons: building terminated because of errors.
C:CodePythonQTPythonExampleQETestProject_CLM>

您需要指定:

/IC:CodeEdwardsEWCppLibraryEWBase

用于编译器。

相关文章: