I am new to the C world and have been tempted to learn more about the ecosystem and to study some language libraries more thoroughly. I have setup on my Visual Studio 2017 and msys2 computer with the Mingw-w64 development packages installed.
I found in Github an open-source project for development with OpenGL which is nothing more than joining the base code to work with a glew + glfw3 + opengl environment. But I'm having trouble linking the glew and opengl libraries.
I'm using CLion for development, and since your build system is CMake, I'm trying to accomplish the conversion of the Makefile project to CMake.
In the original project I had to make some changes to the gcc command line to be able to compile, being the removal of some parameters that caused errors (-framework < * >) and changing the library name of -lGLEW
to -lglew32
, according to the name I found in some quick tutorials on how to use glew in msys.
According to all the answers I find in forums and tutorials, the correct one should be find_package(GLEW REQUIRED STATIC)
, with the uppercase name and without the '32' at the end, but so it can not find the library.
A:/skypartan/AppData/Local/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglew
A:/skypartan/AppData/Local/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lOpenGL
The problem occurs when in CMake I inform find_package(glew32 REQUIRED STATIC)
to add the library to the project and it informs me that the Findglew32.cmake
module does not exist.
By not providing "Findglew32.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "glew32", but
CMake did not find one.
Could not find a package configuration file provided by "glew32" with any
of the following names:
glew32Config.cmake
glew32-config.cmake
Add the installation prefix of "glew32" to CMAKE_PREFIX_PATH or set
"glew32_DIR" to a directory containing one of the above files. If "glew32"
provides a separate development package or SDK, be sure it has been
installed.
The same problem occurs with OpenGL. In both cases when compiling the project by command line I must inform -lglew32 -lopengl32
in msys and only -lGLEW
in ubuntu.
I'd like to know how I can proceed to resolve this problem. CMake only finds modules with the names of libraries specified with the same name they use in ubuntu (GLEW and OpenGL), but none of these names is a valid library in msys (glew32 and opengl32).
I installed glew on msys through pacman with package mingw-w64-x86_64-glew
.