Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/128.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Windows Linux交叉编译中mingw SDL2和mingw之间的冲突_C++_Makefile_Cmake_Cross Compiling_Sdl 2 - Fatal编程技术网

C++ Windows Linux交叉编译中mingw SDL2和mingw之间的冲突

C++ Windows Linux交叉编译中mingw SDL2和mingw之间的冲突,c++,makefile,cmake,cross-compiling,sdl-2,C++,Makefile,Cmake,Cross Compiling,Sdl 2,我在将SDL2应用程序交叉编译到Win32时遇到问题。我确实下载了带有标题的mingw-w64软件包、mingw-w64-sdl2aur软件包和mingw-w64-luajit对于这个应用程序,cmake没有检测到它们的路径,所以我用它们的路径制作了一个工具链文件。克马克开始工作 现在,在mingw文件(intrin.h,stdlib.h)和SDL2文件(SDL\u cpuinfo.h,SDL\u stdinc.h)之间产生一系列冲突,如: 如果有人需要更多信息,我会提供一个文本,其中包含我的C

我在将SDL2应用程序交叉编译到Win32时遇到问题。我确实下载了带有标题的
mingw-w64
软件包、
mingw-w64-sdl2
aur软件包和
mingw-w64-luajit
对于这个应用程序,cmake没有检测到它们的路径,所以我用它们的路径制作了一个工具链文件。克马克开始工作

现在,在mingw文件(
intrin.h
stdlib.h
)和SDL2文件(
SDL\u cpuinfo.h
SDL\u stdinc.h
)之间产生一系列冲突,如:

如果有人需要更多信息,我会提供一个文本,其中包含我的CMake文件内容、工具链以及CMake的输出和错误。并在pastebin中制作:
. 我还缺什么?非常感谢您的帮助。

您不应该使用/usr/include作为交叉编译的头文件。您需要为stdlib.h和类似的东西指定一个指向Windows头的“systeminclude”路径。存在同样的问题。
/usr/i686-w64-mingw32
是交叉编译的系统根吗?如果是,请在工具链文件中相应地标记它:
set(CMAKE\u SYSROOT)/usr/i686-w64-mingw32”)
。通过该设置,编译器不应使用主机include目录
/usr/include/
(除非显式添加)。此外,这有助于CMake在没有工具链中硬编码设置的情况下查找SDL2和LuaJIT。请注意,目前您可以在主机库的
/usr/lib/libz.a
找到ZLIB。也许,您也需要安装mingw ZLIB。@Tsyvarev感谢您的回复,当然,这对我帮助很大,但现在我在关于stdlib_.h..的另一个错误:新的,因此您的代码明确地包含了
/usr/include
。检查传递给
include_目录的变量(使用
message()
命令)。可能是ZLIB造成的(请参阅我之前的评论),您不应该使用/usr/include作为头文件进行交叉编译。您需要为stdlib.h和类似的东西指定一个指向Windows头的“systeminclude”路径。存在同样的问题。
/usr/i686-w64-mingw32
是交叉编译的系统根吗?如果是,请在工具链文件中相应地标记它:
set(CMAKE\u SYSROOT)/usr/i686-w64-mingw32”)
。通过该设置,编译器不应使用主机include目录
/usr/include/
(除非显式添加)。此外,这有助于CMake在没有工具链中硬编码设置的情况下查找SDL2和LuaJIT。请注意,目前您可以在主机库的
/usr/lib/libz.a
找到ZLIB。也许,您也需要安装mingw ZLIB。@Tsyvarev感谢您的回复,当然,这对我帮助很大,但现在我在关于stdlib_.h
..的另一个错误:新的,因此您的代码明确地包含了
/usr/include
。检查传递给
include_目录的变量(使用
message()
命令)。可能是ZLIB造成的(见我之前的评论)。
[ 11%] Building CXX object CMakeFiles/neko8.dir/src/api.cpp.obj
In file included from /usr/include/SDL2/SDL_cpuinfo.h:44:0,
                 from /usr/include/SDL2/SDL.h:38,
                 from /home/pibeplayer/neko8/src/graphics.hpp:4,
                 from /home/pibeplayer/neko8/src/neko.hpp:9,
                 from /home/pibeplayer/neko8/src/api.cpp:3:
/usr/i686-w64-mingw32/include/intrin.h:259:5: error: declaration of ‘int abs(int)’ has a different exception specifier
     __MACHINE(int __cdecl abs(int))
     ^
In file included from /usr/include/SDL2/SDL_stdinc.h:40:0,
                 from /usr/include/SDL2/SDL_main.h:25,
                 from /usr/include/SDL2/SDL.h:32,
                 from /home/pibeplayer/neko8/src/graphics.hpp:4,
                 from /home/pibeplayer/neko8/src/neko.hpp:9,
                 from /home/pibeplayer/neko8/src/api.cpp:3:
/usr/include/stdlib.h:722:12: note: from previous declaration ‘int abs(int) noexcept’
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
In file included from /usr/include/SDL2/SDL_cpuinfo.h:44:0,
                 from /usr/include/SDL2/SDL.h:38,
                 from /home/pibeplayer/neko8/src/graphics.hpp:4,
                 from /home/pibeplayer/neko8/src/neko.hpp:9,
                 from /home/pibeplayer/neko8/src/api.cpp:3:
/usr/i686-w64-mingw32/include/intrin.h:261:5: error: declaration of ‘long int labs(long int)’ has a different exception specifier
     __MACHINE(long __cdecl labs(long))