我尝试从Twinklebar SDL教程运行简单的test.cpp,我收到此错误:
test.cpp:2:10: fatal error: 'SDL2/SDL.h' file not found
所以我在Ubuntu/Mint中查找sdl开发包:
aptitude search sdl | grep 2
我能找到的就是:
libsdl1.2-dev
这是否意味着我唯一的选择是从源代码安装?
这取决于你运行的是哪个Ubuntu版本但是,有一个用于Ubuntu的libsdl2包:http://packages.ubuntu.com/search?keyword = sdl2
调用所需的包libsdl2-dev
.
此外,关于这一#include <SDL/SDL.h>
行,似乎推荐的做法是通过调整编译器标志来添加SDL的include pah和use #include "SDL.h"
.有关详细信息,请参阅https://forums.libsdl.org/viewtopic.php?t=5997.