How to learn SDL? :)

Hello everyone! I’m pretty new to programming but ive read two beginner books on C++. Now I would like to start using the little bit of knowledge I’ve gaining to start making little games with the SDL library. The problem I’m having is I don’t really know how to learn all the predefinded funtions and how they work together. Is there a book that will go in depth and teach me about this library? If not where can I find some good, in depth tutorials online?


I learned SDL2 by looking at source code.
I have a finished SDL2 game on GitHub if you would like to see some code:


The best advice I can give you is to go through as much tutorials as possible. One source of good tutorials are Lazyfoo. Link:
You’ll learn alot going through those. :slight_smile:

1 Like

Thanks a lot guys Ill look into both of your suggestions! Lets get some more suggestions in here! :slight_smile:

That GitHub project I posted above is setup for Windows® Code::Blocks.

  • Install current Code::Blocks C++ IDE onto your Windows®.
  • Run Code::Blocks
  • “Open existing project”: TC4T-WinLinux-Retail2.workspace
  • Click on [Build & Run] icon to compile EXE and run it
  • You now have an SDL2 2D game which builds and runs!



1 Like

oh my! Thank you JeZxLee, that should be very helpful. Going to try it out now! :slight_smile:

Ughh… I tried to compile the program and I keep getting this error that says swprintf_s is undeclaired in this scope. I opened the main.cpp and tried to compile and that’s the problem im having. I had even tried to compile a much simpler game from gethub and I get the same error. What could be the issue?

Ok I realized I had to open the whole workspace, now I have a new error. it says :

warning format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Uint64 {aka long long unsigned int…’

1d.exe - cannot find 1SDL2_ttf
1d.exe - cannot find 1SDL2_mixer
1d.exe - cannot find 1SDL2_image
1d.exe - cannot find 1SDL2main


What is “1d.exe” ?

You need to download from GitHub the “TetriCrisis 4 110% A,I. Turbo” project


1 Like

Those 1’s are supposed to be lowercase L’s. That’s ld.exe, the linker. The warning can be ignored for now. Those errors from the linker say that those libraries can’t be found in the paths specified. If you’re using Code::Blocks, you can set up the paths to those library files (assuming you have them already) in Project > Build options > Search directories > Linker.

1 Like

Ccrap… How am I even supposed to know what libraries it cant find? -_- Why is this so hard…

I would really like to Skype or FB call or text or use any other form of instant communication with anyone who has any experience with the SDL libraries and getting them set up… It has been a struggle figuring all this out. I got JeZxLee’s game to compile finally after reinstalling codeblocks and setting my compiler settings back to default. JeZxLee, I don’t know how to pm you on this forum, how do I contact you? :frowning:

It is a free library. Expect zero to no support.


You should at least try to have a look at the tutorials posted earlier on.
The answer to your installs problems are all answered there I’d wager. (Lesson 6 in particular might prove of interest to you)