is it compatible ?

Hello, I would like to make a hello world program in sdl graphic mode. I am using devcpp 4.0, I downloaded sdl 2.0.10. These seems not to be compatible. Searching *.h files, syntax errors,... What should I do ? Thank you.
Hello fofoun,

Searching *.h files, syntax errors,... What should I do ?


First I would suggest posting the complete error message(s) that you are getting. There is more to these messages than you may understand at this time. Others could see something that you are missing.

I am not familiar with the Dev-C++ 4.0 version, but what you might have is the Dev is not using the C++11 standards and the sdl was written using the 11 standards. Thus the compatibility problem.

Even when I installed the Dev-C++ 5.11 it was not initially set up to use the C++11 standards. I had to change this when I first ran the program.

I do not know if you are stuck using the Dev IDE or if you have a choice. You might consider Code::Blocks or Visual Studios as a more up to date IDE. Both tend to work better with add on like the sdl. Just a thought.

Andy
Hello Andy, thank you for answer. I installed CodeBlocks 13.12, then I tried to compile one of the source codes, that I downloaded with SDL, "SDL_atomic.c", and I got stuck on this error :

C:\Program Files\cppsdl\src\atomic\SDL_atomic.o:SDL_atomic.c|| undefined reference to `SDL_AtomicLock_REAL'|
C:\Program Files\cppsdl\src\atomic\SDL_atomic.o:SDL_atomic.c|| undefined reference to `SDL_AtomicUnlock_REAL'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.8.1\..\..\..\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'|

I tried to search SDL_AtomicLock_REAL as text, but it appears only in binary files. Thank you.
fofun, I don’t want to dishearten you, but, if this is the first time you use an external library, there’re a lot of things you need to learn to take care of (compiler flags, directories, permissions, path…).
So, please bear with my boldness, but, before starting venturing hypotheses, may I ask you what experience you have in C++?
I have little experience in c, I used to write some simple programs. Now I want to start again, to compile a source code, that I downloaded with sdl (goal is to learn how to use sdl). I added some paths, so that *.h files can be found, that is all. What do you suggest I should do ? Thank you for answer.
You welcome, fofun, but I don’t think I can be of much help.

I have little experience in c, I used to write some simple programs. Now I want to start again

To start writing in C or in C++?

I added some paths

So I guess you’re using Windows, aren’t you?
Have you already followed these instructions?
http://wiki.libsdl.org/Installation#Windows_XP.2FVista.2F7.2F8.2F10

I tried to compile one of the source codes, that I downloaded with SDL, "SDL_atomic.c"

What about giving a try to the already compiled library?
https://buildbot.libsdl.org/sdl-builds/sdl-visualstudio/?C=M;O=D
If it works, you just need to link to the dynamic link library (the DLL file).

Anyway SDL is so little (I think it’s about 2 Mb, isn’t it?) that for the first attempts you could also copy it in your project folder — I mean together with your source and header files.
Later of course you’d better learn compiler flags to link to it where it is.

Have you already given a look at this page?
http://wiki.libsdl.org/Tutorials
Thank you, after 3 reinstallations of codeblocks, 8 hours of "work", I managed to compile the first downloaded code.
Now I can not run the debugger. (grey menu, unavailable)
Andy asked, whether I am used to devcpp.. I definitely hadn't such problems there. Thank you for answer.
Last edited on
Problem solved, I cannot debug a simple file with no project. Now I want to draw the whole window with points, I use SDL_RenderDrawPoint. It is extremely slow (more than 10 seconds). I used to write to memory as many points as I want, and then draw it at once. Where can I find it ? Thank you for answer.
Topic archived. No new replies allowed.