Garmaine Staff asked 5 years ago

I'm trying to use CLion to create a SDL2 project. The problem is that the SDL headers can't be found when using #include's.

My CMakeLists.txt file:

cmake_minimum_required(VERSION 2.8.4)

set(SDL2_INCLUDE_DIR C:/SDL/SDL2-2.0.3/include)
set(SDL2_LIBRARY C:/SDL/SDL2-2.0.3/lib/x64)

set(SOURCE_FILES main.cpp)

add_executable(ChickenShooter ${SOURCE_FILES})
target_link_libraries(ChickenShooter ${SDL2_LIBRARY})

My test main.cpp:

#include <iostream>
#include "SDL.h" /* This one can't be found */

int main(){
    if (SDL_Init(SDL_INIT_VIDEO) != 0){
        std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
        return 1;
    return 0;

Thank you for any help you could give me.

Edit: I'm using Windows and CLion is configured to use cygwin64.