Running Opengl program with CLion IDE

I know this question has been asked already but the solutions provided really hasn't worked for me.

I want to run my OpenGL program via CLion IDE. I am able to run the same program via the terminal in Ubuntu using

$gcc progname.c -lglut -lGL -lGLU

but am unable to run the same in CLion

This is my CMakeLists.txt file

enter image description here

PS: I am using CLion in Ubuntu. Also there is no error in the program.



answered 5 months ago Halcyon #1

Clion uses CMake for project files, and CMake makes it easy to link libraries that are in the system paths using target_link_libraries, which you can use in your case as shown below, which can come after the add_executable line:

target_link_libraries(jarvis -lglut -lGL -lGLU)

The documentation for target_link_libraries is here:

comments powered by Disqus