1

I am trying to make a basic program in C++ with OpenGL in CLion. I have installed glew by brew:

brew install glew

but CLion is not able to find it and giving me this error:

Screenshot

CMakeLists.txt file contains this:

cmake_minimum_required(VERSION 3.12)
project(untitled)

set(CMAKE_CXX_STANDARD 14)

add_executable(untitled main.cpp)

How can I fix it ? Is it error in configuration of CLion or am I missing some packages ?

Thank you for help

Jan Černý
  • 1,268
  • 2
  • 17
  • 31
  • 2
    You tag the question with "cmake", so you have probably written the `CMakeLists.txt` file. Show that file: exactly it determines where a compiler searches headers and libraries. – Tsyvarev Sep 12 '18 at 07:41
  • @Tsyvarev Thank you for comment. I have fixed it up. – Jan Černý Sep 12 '18 at 10:41
  • 2
    You should tell CMake (via `CMakeLists.txt` file) that your project uses GLEW libraries and headers. E.g., like in [this answer](https://stackoverflow.com/a/27487567/3440745). – Tsyvarev Sep 12 '18 at 11:06
  • @Tsyvarev Thank you. Know is GLEW ok, but is still red and throwing this: `/Users/John/CLionProjects/untitled/main.cpp:5:10: fatal error: 'GL/gl.h' file not found #include ^~~~~~~~~ 1 error generated. make[3]: *** [CMakeFiles/untitled.dir/main.cpp.o] Error 1 make[2]: *** [CMakeFiles/untitled.dir/all] Error 2 make[1]: *** [CMakeFiles/untitled.dir/rule] Error 2 make: *** [untitled] Error 2` – Jan Černý Sep 12 '18 at 11:57
  • 1
    GLEW, GL and GLU are *different* libraries. You should inform CMake about them separately (but in a similar way). So, technically, your problem can be divided into **3 separate problems**: 1. Use GL in a CMake project. 2. Use GLEW. 3. Use GLU. You may find information about each problem in different sources. – Tsyvarev Sep 12 '18 at 13:29

0 Answers0