# Setting up SFML with CLion on Windows 10

For a school project I am trying to set up SFML on my computer that runs Windows 10. The assignment is developing a small engine, based on SFML, in a few weeks. I am very new to C++, and I am not used to the working pipeline and the ways of C++ development yet.

At the moment I am trying to set things up so that I can work on the project from home, but I have a lot of trouble understanding and setting things up, since it's very different to what I'm use to.

My CMakeLists.txt file looks like the following:

cmake_minimum_required(VERSION 2.8.4)
project(CppEngine)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules") if(WIN32) set(SFML_ROOT "$ENV{PROGRAMFILES(x86)}/SFML")
endif(WIN32)
set(CMAKE_BUILD_TYPE Release)
find_package(SFML 2.1 COMPONENTS system window graphics REQUIRED)
include_directories(${SFML_INCLUDE_DIR}${PROJECT_SOURCE_DIR})
set(SOURCE_FILES main.cpp   )
add_executable(CppEngine ${SOURCE_FILES}${HEADER_FILES})


I get a very strange error message, as a result, whenever I try to compile and run. It is particularly strange, because I am running on Windows:

error: #error This UNIX operating system is not supported by SFML library #error This UNIX operating system is not supported by SFML library

How can I fix this error?

CLion only supports Cygwin or MingW for Windows development. Cygwin is a compatibility layer for UNIX-like operating systems; MingW is a port of the UNIX development tools for creating native Windows applications. Microsoft's native development tools are unsupported by CLion according to their documentation.

Most desktop-like things such as games (that require OS-native features like graphics, audio, input, etc.) aren't going to work with Cygwin because it can't access native Windows APIs. You can eventually rig Cygwin up to run desktop apps on Windows, but the process is painful, the results are sub-par, and game frameworks like SFML will almost never bother to actually support such a configuration.

From a little Googling, others who've run into the SFML error you've posted were trying to use Cygwin. To SFML it looks like a UNIX system because that's what Cygwin pretends to be, hence why it thinks your Windows 10 OS is an "unknown UNIX operating system." The developers should properly detect Cygwin and at least provide a more accurate and detailed error ("SFML does not support the Cygwin environment; please use MingW if you wish to use UNIX development tools.") but that's their problem. :)

Solution:

You'll either need to

or

1. Switch to using the free and fully-featured Microsoft Visual Studio Community development tools instead of CLion so you can get first-class Windows development capabilities.

I recommend the second option very strongly. Unless your school's curriculum requires you to use CLion for some reason, in which case I recommend transferring to a better school. :)

• Just to confirm as someone contributing to SFML: SFML indeed doesn't support Cygwin, because of its weird hybrid state, especially considering available headers/API. Going to add a more explicit message later. Sep 21 '16 at 5:29
• Thanks for the answer, I slightly suspected it must have been something along those lines since the path that accompanies the error goes through cygwin. I will go for the answers in the order you say because I work on osx mostly and I prefer to have my workflow more streamlined (so that gives clion a higher priority). Sep 21 '16 at 13:03
• @MTesseracT: you might consider VS Code then which has a C++ mode that supports both Microsoft's tools on Windows and clang++/lldb on OSX. About as close to the best of both worlds as you're going to get. Sep 22 '16 at 4:16