We've been using SDL in my computer class for a while now, and I figured that I should try to start using it at home as well. I've already got Dev-C++ on my computer and it works fine, but I can't get my SDL programs to work. I made a code for pong at class, and it worked fine, but when I tried to get the same code to work on my computer at home (brought over on a flash drive) it won't run.
Here's part of the error message:
SDL/SDL.h: No such file or directory.
SDL/SDl_image.h: No such file or directory.
... and then it goes on to not recognize any of my SDL related code.
I don't know what I'm supposed to do, so if anyone has any ideas your comments would be much appreciated!
I know this question may sound stupid, but I need to ask: you did install the includes, libs, and DLLs, right? http://www.libsdl.org/
After that, the includes need to be somewhere where the compiler can find them. For example, "<personal dir>\C++\include\SDL\".
You'd need to tell Dev-C++ that you want GCC to look for headers in "<personal dir>\C++\include\".
Then you need to link to the libs you need (in this case, SDL.lib and SDL_image.lib). These could be in "<personal dir>\C++\lib\". More often than not, linking to libs requires a project.
Finally, you need to place the DLLs somewhere where the OS will find them. This is: a) in the same directory as the program, or b) any of the directories in the PATH environment variable. PROTIP: duplicating the same library for each executable defeats the purpose of having a DLL, so it's easier to put it in c:\windows\system32\ or wherever the directory with that purpose happens to be named in the Windows version in question.
Thanks guys, I'm still trying to get use to SDL, and I wasn't able to get much when I went to the website, so I didn't have all that stuff. That lazyfoo site was very helpful, and I was able to follow most of the steps on setting up SDL, but step 3 says to move a subfolder called bin into the C++ bin folder. But there was no bin subfolder in the zip folder I downloaded on the website, and like I said, I wasn't able to get much from libsdl. I'm sorry if I didn't explain that well, but if you could tell me exactly what you did to get SDL working, maybe that would help.
btw
I was able to follow the rest of the steps, and the "SDL/SDL.h: No such file or directory." error message no longer occurs (but the second one still does).
I got the same problem, or at least i got a problem with SDL image to. I'm learning how to use SDL by this tutorial: http://lazyfoo.net/SDL_tutorials/index.php. My compiler is dev-cpp.
I have downloaded SDL, and it works correctly. Now i have downloaded the SDL image libary, exactly as the tutorial describes. I have downloaded the files, copied the include files to the include map in dev-cpp. The .dll file is in both the bin map of dev-cpp as in the map where i have my project. I have one sourcefile (main.cpp) in my Win32 GUI project. As paramater i have:
-lmingw32 -lSDLmain -lSDL-ISDL_image
I have included SDL_image.h in my sourcefile.
This is the error i get:
cannot find -lSDL-ISDL_image
I have spend the last hour checking or everyting is at the right location etc., so that wont be the problem. Does anyone know what i'm doing wrong?