SDL2 with windows and code::block

i try to launch a minimalist code to launch a SDL window. you can find it with this link: premier code.[]
I have configured code::block and when i build it is Ok but when i launch the code, i have an error message saying that directX not available.
Any suggestion?

I’m assuming you’re on Windows. Which version is it exactly?

SDL provides a feature that lets you select the video driver with an environment variable. The variable is called SDL_VIDEODRIVER. If you set this environment variable to “directx”, SDL 2 will complain that it doesn’t have such a driver with “directx not available”.

“directx” is a video driver in SDL 1.2. Perhaps you have this environment variable set for your user or system?

Try opening cmd.exe, type SET and press enter. This will list all environment variables. Check if there are any SDL_* variables set. If you find SDL_VIDEODRIVER, you can delete it in the appropriate control panel menu. There are a few resources like this on the internet on how to do that.

It’s possible that code::blocks has the ability to set environment variables for the programs it is launching. Check in its configuration if there’s anything.


Please download our open-source cross-platform game “LettersFall 5” below:

Just decompress and then open the “LettersFall5Game.workspace” file with Code::Blocks.
Feel free to read, modify, and use the source code for your own projects.
Game will be released for free on Windows 10 Store very soon…

16BitSoft Inc.
Video Game Design Studio

that was that!
Thanks a lot!