jeudi 23 février 2017

How to configure Clion to work with SDL2?

I´m just trying to learn how to use SDL in Clion (the Jetbrains IDE), i found an answer in a post to edit my CMakeLists.txt, i did it!! but it didn´t worked.

I can use the libraries but I can´t compile it, in the image you can see the error in the output console.

Can somebody help me to configure it, please

This is my CMakeLists.txt

cmake_minimum_required(VERSION 3.6)
project(OpenGLTest)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -lmingw32")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")

include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${PROJECT_SOURCE_DIR}/lib)

set(SOURCE_FILES main.cpp)
add_executable(OpenGLTest ${SOURCE_FILES})

target_link_libraries(OpenGLTest libSDL2main libSDL2 libSDL2_test)

And this is my main.cpp

#include <iostream>
#include <SDL.h>

int main() {
    SDL_Init(SDL_INIT_EVERYTHING);
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

PS: This is the code that I wrote is just to test the compiling.

This is the error in Clion console

Error

Aucun commentaire:

Enregistrer un commentaire