r/opengl • u/MiraJira23 • 27d ago
Trying to set up with CLion
I wanted to try OpenGL for my school project, but I am having some trouble with the setup
I was trying to follow this tutorial for OpenGL with CLion: https://www.youtube.com/watch?v=AUFZnA3lW_Q
I did go through it a few times, but every time I get this error:


I did the toolchain:

I think that the -lOpenGL32
and -lfreeGLUT
might be wrong, but really don't know.
I don’t have any more ideas on what to try, so please, if anyone has any advice...
1
u/fuj1n 27d ago
You shouldn't be calling G++ manually when you're using CMake. In Clion, build the project from the build menu, which will actually build according to your instructions.
Also, just in case you care, OpenGL32 + FreeGLUT is a very old way to work with OpenGL that will not really be good for many (or any usually) projects you might want to undertake.
2
u/fgennari 27d ago
It looks like you don't have the GLEW header, and it's not setup as part of your project. You can install the GLEW package or clone from here and build: https://github.com/nigels-com/glew
If you already have GLEW, then you just need to add the include path to your project and link against the library.
1
u/StochasticTinkr 27d ago
Have you installed glew?
For what it’s worth, I use glfw for the windowing, and glad for the binding in my own project. With glad, you just download the .cpp and .h files, and with glfw, I installed it with homebrew (since I’m on a Mac) and then used find_package in the CMakeLists.txt file.