[BEGINNER] CLION, Mingw, windows and library
Friendly greetings !
So, i'm a beginner at developping on windows with C++. I usually do C# or fortran on windows, and pretty much everything on linux.
Also a beginner at CLION and CMake ... it's going to be a long trip.
The thing is, no matter how hard i try, i can't manage to use GLEW, i have a linker error.
Here is what i manage to do after a lot of trial and error :
set(CMAKE_PREFIX_PATH "D:\\clionproject\\libs\\glew-2.1.0")
set(CMAKE_LIBRARY_PATH "D:\\clionproject\\libs\\glew-2.1.0\\lib\\Release\\x64" ,
"D:\\clionproject\\libs\\glfw-3.3.bin.WIN64\\lib-mingw-w64")
...
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIRS})
link_libraries(${GLEW_LIBRARIES})
target_link_libraries(testingopengl ${GLFW_LIBRARY})
When i build i get this error :
CMakeFiles\testingopengl.dir/objects.a(AppMain.cpp.obj): In function `AppMain::run()':
D:/clionproject/testingopengl/AppMain.cpp:35: undefined reference to `__imp_glewInit'
collect2.exe: error: ld returned 1 exit status
I used the GLEW binary zip, it come with .h, .lib, .dll
I tried many things, i just can't make it works.
Now i'm wondering... i think i heard that library on windows have a different format/interface/whatever when compiled with gcc or visual studio.
Would it be possible that my problem happens because the glew binary was compiled for visual studio and i use mingw ? Is this a thing ?
Does it happens with dll too ? i'm not sure if i'm trying to compile statically or dynamically here.
Is there a solution ? Will i have this problem with every dynamic library or am i just doing something wrong in my CMakelists ?
I know the post is a bit messy, but it's even worse in my head -_-
Please sign in to leave a comment.
Hello!
>Would it be possible that my problem happens because the glew binary was compiled for visual studio and i use mingw ? Is this a thing ?
This might be the reason. https://github.com/nigels-com/glew/blob/master/README.md contains instruction how to build GLEW with MinGW/MinGW-w64. Maybe pre-build libraries for MinGW can be found somewhere.