且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CMake:与MinGW交叉编译linux-to-windows找不到某些系统头文件

更新时间:2023-11-09 15:46:28

我认为我已经找到解决问题的方法(不确定是否是***的方法)。我在 CMake邮件列表中发现了类似的问题,并提出了答案似乎可行:。

I think I have found a solution to my issue (Not sure whether it is the best one). I have found similar question in the CMake mailing list and the answer proposed there seems to work: .

看来,这种情况可能是由于自己的MinGW工具集没有正确的内置包含目录引起的。无论如何,对我来说,解决方案是将此行添加到我的工具链文件中:

It seems that this situation could be caused by the own MinGW toolset not having the right built-in include directories. Anyways, the solution for me was to add this line into my toolchain file:

set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/lib/gcc/${TOOLCHAIN_PREFIX}/7.3-posix)