在编译SDL 2的同时编译我自己的源文件。

问题描述 投票:1回答:1

由于编译错误,我无法正确使用SDL动态链接,我不喜欢走静态链接的路线,因为我不确定这在我使用的语言中实现得如何。

这就是为什么我想手动编译SDL 2的源文件,我只是简单地使用了官方repo中include和src下的文件,但在编译时我得到了这个错误。

In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/video.c:23:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/keyboard.c:26:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/gl.c:23:
/Users/adtrevor/CompileSDL/Sources/SDL/src/video/qnx/sdl_qnx.h:26:10: fatal error: 'screen/screen.h' file not found
#include <screen/screen.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.

我知道这是有可能的,因为官方网站上有提到,但我不知道我应该遵循什么步骤才能使其正确工作?

EDIT :这里是示例repo。https:/github.comadtrevorcompileSDL。

c swift sdl-2
1个回答
0
投票

SDL是一个跨平台的库,你不可能为了得到你需要的功能而编译所有的源文件。 通常情况下,你需要运行 configure make它将决定哪些文件应该构建哪些文件。

您提到您正在自己构建源文件;因此您可能想反过来构建SDL,并尝试捕获相同的文件。 关于您的错误,QNX 是黑莓操作系统--因此根据您的使用情况,您可以避免在以下情况下编译所有文件 SDL/src/video/qnx/* 因为无论如何您都没有这些操作系统头文件。

无论如何,SDL应该默认构建静态库。 考虑进行常规构建,并使用 sdl-config --static-libs 找出你应该与哪些静态库链接。

© www.soinside.com 2019 - 2024. All rights reserved.