0

I am trying to set up SDL2, but it returns with Process finished with exit code -1073741515 (0xC0000135). Any idea? I can only imagine there is some mistake in my CMakeLists.txt, but the cmake compiles and the project builds properly.

Here is a simple code using SDL that I tested:

#include <SDL2/SDL.h>

int main()
{
    // retutns zero on success else non-zero
    SDL_Window* win = SDL_CreateWindow("GAME",
                                       SDL_WINDOWPOS_CENTERED,
                                       SDL_WINDOWPOS_CENTERED,
                                       1000, 1000, 0);

    return 0;
}

And here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.15)
project(SDL_project)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR})

add_executable(SDL_project main.cpp)

target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARY} -lmingw32 -mwindows)
add_definitions(-DSDL_MAIN_HANDLED)
Daniel
  • 391
  • 4
  • 17
  • 1
    The error message is easily googled. You need to add your SDL2 libraries into the `PATH` variable. – Tsyvarev Mar 31 '20 at 13:31
  • Thanks! I just managed to solve it by copying the dll file from the SDL bin library to the mingw32 bin library, but using set path is a cleaner solution. – Daniel Mar 31 '20 at 13:41

0 Answers0