简体   繁体   English

SDL.h:没有这样的文件或目录

[英]SDL.h: No such file or directory

I've installed libsdl 1.2 -dev on my Ubuntu but the problem is that it doesn't understand #include<SDL.h> 我在我的Ubuntu上安装了libsdl 1.2 -dev ,但问题是它不理解#include<SDL.h>

And it says: 它说:

SDL.h: No such file or directory

But when i type: 但当我输入:

kit0n@ubuntu:~$ g++ sepand.cpp -o sepand -lSDL

The project compiles without any problems. 该项目编译没有任何问题。 What should I do to make Ubuntu understand SDL.h? 我该怎么做才能让Ubuntu了解SDL.h?

The correct way is to add `sdl-config --cflags` to your CXXFLAGS. 正确的方法是将`sdl-config --cflags`添加到CXXFLAGS。 (You should also add `sdl-config --libs` to your LIBS even thou it doesn't seem to be needed in your case.) (你也应该把`sdl-config --libs`添加到你的LIBS中,即使你的情况似乎不需要它。)

Paraphrasing from the link: use the output of the command sdl-config --cflags --libs for SDL 1.2 or sdl2-config --cflags --libs for SDL2, for example: 从链接释义:使用命令sdl-config --cflags --libs for SDL 1.2或sdl2-config --cflags --libs for SDL2的输出,例如:

gcc -o test test.c `sdl-config --cflags --libs`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM