[英]SDL MinGW Netbeans. <SDL/SDL.h> no such file or directory
Go to bottom to see the solution. 转到底部以查看解决方案。
Hello everybody i've been googling' looooong time and I didn't find anythinig, so, here we go: 大家好,我一直在搜寻'looooong'的时间,但我没有找到任何东西,因此,我们开始:
I have this setup: 我有这个设置:
Compiler: MinGW
编译器:MinGW
IDE: NetbeansIDE:Netbeans
Library: SDL库:SDL
Language: C++语言:C ++
Okey, so, i have included this folder: "C:/SDL_1.2.15/include"
Okey,所以,我已经包含了这个文件夹:
"C:/SDL_1.2.15/include"
And Linked those libraries in this order: 并按以下顺序链接这些库:
-lmingw32 -lmingw32
-lSDL_main -lSDL_main
-lSDL -lSDL
Then if I use a normal program without the #include "SDL/SDL.h"
then compiles okeey. 然后,如果我使用没有
#include "SDL/SDL.h"
的普通程序,则编译okeey。 So if i include the SDL header file the IDE gives me greenlight to compile an then, i get this output: 因此,如果我包含SDL头文件,IDE会允许我进行编译,然后得到以下输出:
"C:/WinAVR-20090313/utils/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
"C:/WinAVR-20090313/utils/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/sdl_test.exe
make[2]: Entering directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++.exe -c -g -Wall -I/C/MinGW/include -I/C/SDL-1.2.15/include -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
make[2]: Leaving directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
make[1]: Leaving directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
main.cpp:11:21: error fatal: SDL/SDL.h: No such file or directory
compilaci�n terminada.
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
So! 所以! Here is the source code of my application, it only has a 'main.cpp' file:
这是我的应用程序的源代码,它只有一个“ main.cpp”文件:
/*
* File: main.cpp
* Author: pablo
*
* Created on 1 de septiembre de 2013, 23:20
*/
#include <cstdlib>
#include <windows.h>
#include <SDL/SDL.h>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
return 0;
}
I've found new issues; 我发现了新问题; When I remove the #include (comment //) then the console throws me this errors instead the 'no such file or directory':
当我删除#include(注释//)时,控制台将抛出此错误,而不是“无此类文件或目录”:
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lSDLmain
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lSDL.dll
When I compile without #include using Cygwin compiler, the project builds correctly. 当我使用Cygwin编译器不使用#include进行编译时,项目将正确构建。
Found another issue: 发现另一个问题:
make[2]: *** No rule to make target `/C/SDL-1.2.15/lib/libSDLmain.a', needed by `dist/Debug/MinGW-Windows/sdl_test.exe'. Stop.
this happens when I add the full path to the SDL libraries instead of -lSDL.dll and -lSDL_main 当我将完整路径添加到SDL库而不是-lSDL.dll和-lSDL_main时,会发生这种情况
SOLUTION:
解:
The problem solves coping c:/SDL-1.15/include/SDL/ folder to c:/MinGW/include/ directory, and libraries from lib on c:/SDL-1.15/lib/SDL to MinGW/lib
You have to add the headers separately. 您必须单独添加标题。 It's not enough to do the include, you have to do multiple things to add a thing like SDL in your project.
进行包含是不够的,您必须做很多事情才能在项目中添加类似SDL的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.