mingw / include / c ++ / cstdlib:stdlib.h:没有这样的文件或目录

时间:2017-07-21 20:06:06

标签: c++ gcc cmake mingw fedora

我正在尝试使用MinGW在Fedora 26上为64位Windows交叉编译OpenImageIO。使用yum检索依赖项的mingw版本后,我运行了mingw64-cmake,后跟make。但是,我立即收到关于stdlib.h未找到的编译错误。

[  0%] Built target CopyFiles
[  0%] Building CXX object src/libutil/CMakeFiles/OpenImageIO_Util.dir/argparse.cpp.obj
In file included from .../oiio/src/libutil/argparse.cpp:36:0:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
              ^~~~~~~~~~
compilation terminated.

我已确认stdlib.h至少在/usr/include//usr/x86_64-w64-mingw32/sys-root/mingw/include/c++/中找到了stdlib.h: No such file or directory,其中发出了编译错误的文件。

为什么我仍然收到错误The preprocessor directive #include_next behaves like the #include directive, except that it specifically excludes the directory of the including file from the paths to be searched for the named file.

更新 我做了更多的研究并学习了以下内容:cstdlib

这可以解释为什么stdlib.h找不到同一文件夹中的cstdlib。但.../topology-workers/sdp-acs-... .../topology/sdp-acs-... 是MinGW的一部分,而不是我试图编译的代码的任何部分。所以我仍然不知道这里有什么问题或如何解决这个错误。

编辑:以下是编译器版本信息,以防它有用:https://pastebin.com/PZiXS2fg。这是一个全新安装,所以不应该有任何异常。

2 个答案:

答案 0 :(得分:2)

我解决了,我可以再次编译。

解决方案(对我来说)是添加到变量CPLUS_INCLUDE_PATH的路径并将其设置为MinGW c ++ include目录,对我来说:C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++

我希望它也适合你。

答案 1 :(得分:0)

根据我的Google搜索,使用#include_next似乎会导致很多问题。请尝试使用以下语法直接包含stdlib.h

-isystem /usr/x86_64-w64-ming32/sys-root/mingw/include/c++

gcc 6.0中添加了此语法以解决第三方库的问题。有关方法和推理,请参阅here

编辑:更改了答案以反映有关gcc wrapper_headers和#include_next的新信息

相关问题