How to run SDL2 on Windows 10 with CLion, MinGW

0

I wrote a following simple code

#include <stdio.h>
#include <SDL2/SDL.h>

int main(int argc, char *argv[]) 
{
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
    }
    printf("SDL_Init success!\n");
    return 0;
}

CLion compile it without any errors and build .exe file but after running i've got nothing on the screen and error

Process finished with exit code -1073741701 (0xC000007B)

here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(ff)

set(SDL2_PATH "C:\\MinGW\\i686-w64-mingw32")
set(CMAKE_C_STANDARD 99)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${ff_SOURCE_DIR}/cmake")
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR})

add_executable(fdf
        main.c)
target_link_libraries(ff ${SDL2_LIBRARY} -lmingw32 -lSDL2main -lSDL2 -mwindows)

Show me the way to solve this and explain where I'm wrong.

c
cmake
sdl-2
clion
mingw-w64
asked on Stack Overflow Mar 11, 2020 by Ivanov Viktor • edited Mar 11, 2020 by genpfault

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0