What is the difference between SDL and SDL2?

I see references to both SDL and SDL2. What's the difference between them and which one should I use for a new project?

SDL stands for Simple DirectMedia Layer. It's a popular cross-platform library for developing applications with graphics, sound, input handling, etc.

SDL2 is the latest major version of the library. The original SDL (sometimes referred to as SDL1) is no longer actively developed. SDL2 includes many improvements and new features compared to SDL1, such as:

  • Hardware-accelerated 2D rendering
  • Support for multiple windows
  • Better Unicode support
  • Support for multiple audio devices
  • Game controller support
  • Force feedback support

For any new projects, you should use SDL2 as it represents the current version of the library. SDL1 should only be used for maintaining legacy applications.

When downloading SDL, make sure you get the SDL2 version, not the older SDL1 version. The downloads, documentation, etc. for SDL2 are all clearly marked, e.g. "SDL2-devel-2.x.x-VC.zip".

So in summary - use SDL2 for new projects, as it's the modern, supported version of the excellent SDL library.

Setting up SDL2 in Windows (Visual Studio)

A step-by-step tutorial on configuring SDL2, SDL_image and SDL_ttf in a Visual Studio C++ project on Windows

Questions & Answers

Answers are generated by AI models and may not have been reviewed. Be mindful when running any code on your device.

What is the difference between static and dynamic linking?
The lesson mentions 'linking' the SDL libraries to our project. What exactly is linking, and what's the difference between static and dynamic linking?
Why do I need to copy the DLL files to my executable directory?
The lesson says to copy the SDL .dll files to the same directory as my .exe file. Why is this necessary? Can't I just keep them in the SDL library directories?
What do the SDL_Init, IMG_Init and TTF_Init functions do?
The example code calls SDL_Init, IMG_Init and TTF_Init. What are these functions actually doing?
How can I troubleshoot unresolved external symbol linker errors?
I tried to set up SDL following the lesson, but I'm getting 'unresolved external symbol' errors when I try to compile. How can I troubleshoot this?
What are some common SDL compilation errors and how can I fix them?
Apart from linker errors, what other kinds of compilation errors might I encounter when starting with SDL, and how can I troubleshoot them?
Or Ask your Own Question
Get an immediate answer to your specific question using our AI assistant