# Configure Clion to work with GLFW

**URL:** <https://discourse.glfw.org/t/configure-clion-to-work-with-glfw/868>\
**Category:** support\
**Created:** [March 3, 2017, 4:32pm UTC](https://discourse.glfw.org/t/configure-clion-to-work-with-glfw/868 "2017-03-03T16:32:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SupineDread](https://avatars.discourse-cdn.com/v4/letter/s/3d9bf3/32.png) [@SupineDread](https://discourse.glfw.org/u/SupineDread)\
**Post date:** [March 3, 2017, 4:32pm UTC](https://discourse.glfw.org/t/configure-clion-to-work-with-glfw/868/1 "2017-03-03T16:32:07Z")

</div>

Hello.

I´m trying to use GLFW witth Clion (the Jetbrains IDE), i configured the CMakeLists.txt getting help from other project, but compiling this project y have some troubles.

this is my output console error: [https://gyazo.com/825012df43ea0b904afa324cc51d17bc](https://gyazo.com/825012df43ea0b904afa324cc51d17bc)

this is my CMakeLists.txt:

```
cmake_minimum_required(VERSION 3.6)
project(TestGLFW)

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(TestGLFW ${SOURCE_FILES})

target_link_libraries(TestGLFW mingw32 glfw3)

```

And this is my test source:

```
#include <GLFW/glfw3.h>

int main(void){
    GLFWwindow* window;
    if (!glfwInit())
        return -1;

    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window){
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window);

    while (!glfwWindowShouldClose(window)){
        glClear(GL_COLOR_BUFFER_BIT);
        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

```

Help!!

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [March 3, 2017, 4:49pm UTC](https://discourse.glfw.org/t/configure-clion-to-work-with-glfw/868/2 "2017-03-03T16:49:40Z")

</div>

I’m not an expert with mingw32, but it looks like it expects a winMain function rather than a main function.

[See this tutorial for an example](http://www.transmissionzero.co.uk/computing/win32-apps-with-mingw/).

You should be able to simply replace `int main(void)` with:

```
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

```

It is possible to use main() with windows by setting the entry point to be that function, but I do not know how to do that with mingw32.
