C++ SDL/SDL_image.h:没有那个文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6843572/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SDL/SDL_image.h: No such file or directory
提问by Knarf
I'm trying to follow Lazy Foo'stutorials. But when I try to run one of his examples I get this compiler error:
我正在尝试遵循Lazy Foo 的教程。但是当我尝试运行他的一个例子时,我得到了这个编译器错误:
error: SDL/SDL_image.h: No such file or directory
错误:SDL/SDL_image.h:没有那个文件或目录
The compiler/linker is set up correctly, I'm using Code::Blocks on Windows XP.
编译器/链接器设置正确,我在 Windows XP 上使用 Code::Blocks。
However, the problem is simply that there are no SDL_image.h. I've checked in the folder that it supposedly should have been. I tried to download the SDL library again and checked again, still no SDL_image.h file. Where did the SDL_image.h file go?
然而,问题只是没有 SDL_image.h。我已经检查了它应该存在的文件夹。我再次尝试下载 SDL 库并再次检查,仍然没有 SDL_image.h 文件。SDL_image.h 文件去哪儿了?
The library I dowloaded was the 'SDL-devel-1.2.14-mingw32.tar.gz' under 'Development Libraries' for Win32 from this link: http://www.libsdl.org/download-1.2.php
我从以下链接下载的库是 Win32 的“开发库”下的“SDL-devel-1.2.14-mingw32.tar.gz”:http: //www.libsdl.org/download-1.2.php
回答by Piotr Praszmo
回答by razz
You need to install SDL_image library like mentioned in the other answers, if you are on a Debian based systems you can simply install with the following command:
您需要像其他答案中提到的那样安装 SDL_image 库,如果您使用的是基于 Debian 的系统,则只需使用以下命令进行安装:
sudo apt-get install libsdl-image1.2-dev
回答by Alavro
In the third tutorial of lazyfoo is completely explained.
在第三个教程中对lazyfoo 进行了完整的解释。
Basically, you must add "-lSDL_image" to the compilation line.
基本上,您必须在编译行中添加“-lSDL_image”。
回答by kenneth odoh
In your case as you are using windows, then you should first install sdl_image
and then
在您使用 Windows 的情况下,您应该先安装sdl_image
,然后
#include <SDL_image.h>
not
不是
#include <SDL/SDL_image.h>
If you were using linux and your sdl-image
package is installed to /usr/include/SDL
then you need to use
如果您使用的是 linux 并且您的sdl-image
软件包已安装到/usr/include/SDL
那么您需要使用
#include <SDL_image.h>
In most cases when you install from source in linux. Your package may not be resident in /usr/include/SDL
在大多数情况下,当您在 linux 中从源代码安装时。您的包裹可能不在/usr/include/SDL
In these kind of situation, I use
在这种情况下,我使用
#include <SDL/SDL_image.h>
and it works
它有效
回答by MR. J
i had same problem "error: SDL/SDL_image.h: No such file or directory", i solved this by doing this: http://wiki.codeblocks.org/index.php?title=Using_SDL_with_Code::Blocks...look at the picture with name "Project's build options" and write things inside that red circles in my case it helped. Good luck! (sorry for bad English) :P
我有同样的问题“错误:SDL/SDL_image.h:没有这样的文件或目录”,我通过这样做解决了这个问题:http://wiki.codeblocks.org/index.php?title=Using_SDL_with_Code::Blocks ...查看名称为“项目的构建选项”的图片并在我的情况下在红色圆圈内写下内容它有帮助。祝你好运!(抱歉英语不好):P
回答by Eric F
For anyone who tries this, an update would be to actually add "-lSDL2_image" to your compilation line. Everyone else simply has -lSDL_image" which changed when SDL2 released. After that just go to the bin and add all of your .dll files to System32 and you should be all set!
对于尝试此操作的任何人,更新实际上是将“-lSDL2_image”添加到您的编译行。其他人只是有 -lSDL_image",它在 SDL2 发布时发生了变化。之后,只需转到 bin 并将所有 .dll 文件添加到 System32 中,您就应该全部设置好了!
回答by NadiR_Troubleshooter
You have to Download "SDL_image-devel-1.2.4-VC6.zip" For code blocks download link ? http://www.libsdl.org/projects/SDL_image/release/SDL_image-devel-1.2.4-VC6.zip
您必须下载“SDL_image-devel-1.2.4-VC6.zip”代码块下载链接? http://www.libsdl.org/projects/SDL_image/release/SDL_image-devel-1.2.4-VC6.zip
copy the files present in the include folder that you will find inside the zip file after extraction.And paste it to the C:\SDL\include\SDL in my case or to the directory where your other SDL *.h are present.
复制解压后您将在 zip 文件中找到的包含文件夹中的文件。在我的情况下,将其粘贴到 C:\SDL\include\SDL 或其他 SDL *.h 所在的目录。
Similary, Copy the files present in the lib folder of the zip file and paste it to C:\SDL\lib or to the folder where other lib files are present.. Then copy all the *.dll files present in the archive to the C:\windows\system32 Further you have to add "-lSDL_image" to the compilation line by openning settings > compiler& debugger > linker.
类似地,复制 zip 文件的 lib 文件夹中存在的文件并将其粘贴到 C:\SDL\lib 或其他 lib 文件所在的文件夹中。然后将存档中存在的所有 *.dll 文件复制到C:\windows\system32 此外,您必须通过打开设置>编译器和调试器>链接器将“-lSDL_image”添加到编译行。
Then open a empty file project and add empty file to the project then #include "SDL\SDL_image.h" Hope it works for you !!
然后打开一个空文件项目并将空文件添加到项目然后#include "SDL\SDL_image.h" 希望它对你有用!!
Or
或者
First download SDL_image-devel-1.2.4-VC6.zip from above given link and Goto link >> http://www.lazyfoo.net/SDL_tutorials/lesson03/windows/codeblocks/index.phpfor more detailed explaination.
首先从上面给定的链接和转到链接 >> http://www.lazyfoo.net/SDL_tutorials/lesson03/windows/codeblocks/index.php下载 SDL_image-devel-1.2.4-VC6.zip以获得更详细的解释。