Answer the question
In order to leave comments, you need to log in
How to connect SDL2 to clion in ubuntu?
The cmakelist file looks like this
cmake_minimum_required(VERSION 3.5)
project(rpg)
# includes cmake/FindSDL2.cmake
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR})
set(CMAKE_CX{X_FLAGS "$ -std=c++11")
set(SOURCE_FILES main.cpp sdlfx.h)
add_executable(rpg ${SOURCE_FILES})
target_link_libraries(rpg ${SDL2_LIBRARY})
Main file - #include "SDL2/SDL.h"
#include "sdlfx.h"
using namespace std;
int main(int argc, char *argv[]) {
SDL_Init(SDL_INIT_EVERYTHING);
int a = SDL_INIT_EVERYTHING;
cout << a;
return 0;
}
Answer the question
In order to leave comments, you need to log in
The library is not linked. Check what you have in ${SDL2_LIBRARY} .
PS You don't need to specify header files in the source list.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question