Adding SDL2 causes immediate crash when only including header

I just added SDL2 via CMake and am experiancing unknown behavior. After adding SDL to my library and only including the SDL2/SDL.h file, my program immediately crashes with no error.

Steps Taken:

  1. Download SDL2-devel-2.28.5-mingw.zip from release-2.28.5 and unpack to contents to <project_root>/deps/SDL2.
  2. Added the following to my CMakeLists.txt:
set(SDL2_DIR "deps/SDL2/cmake")
find_package(SDL2 REQUIRED)
...
include_directories(mylib ${SDL2_INCLUDE_DIRS})
target_link_libraries(mylib PUBLIC SDL2::SDL2main SDL2::SDL2)
  1. Build project, results successful.
  2. Include the SDL/SDL2.h header in my source code somewhere without any SDL2 specific code (eg SDL_Init)
  3. Run the program, get Process finished with exit code -1073741515 (0xC0000135).

There is no error/stack trace to explain what is going on. I can only assume it is either a result of my cmake configuration or there is something going on the SDL2 that I don’t understand.

Any assistance would be greatly appreciated.

Also note that it took me several hours just to get to this point as the simple instructions in the SDL2 repo are short and I feel leave a lot of explanation of setup out.