mingw32/bin/ld.exe: cannot find -lglew

23 Views Asked by At

I use CLion and gcc as default compiler. GLEW and GLFW was compiled through the MinGW-32.

I have that CMake File

add_executable(${PROJECT_NAME} main.cpp)

#OpenGL
find_package(OpenGL)
if(NOT OpenGL_FOUND)
    message(ERROR "OpenGL was not found")
endif ()

# GLFW
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libs/GLFW/lib/cmake/glfw3/")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/libs/GLFW/include")
find_package(glfw3 3.4.0 CONFIG)
if(NOT glfw3_FOUND)
    message(FATAL_ERROR "GLFW3 was not found")
endif ()
target_link_libraries(${PROJECT_NAME} glfw)

# GLEW
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libs/GLEW/lib/cmake/glew/")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/libs/GLEW/include")
find_package(glew CONFIG)
if(NOT glew_FOUND)
    message(FATAL_ERROR "GLFW3 was not found")
endif ()
target_link_libraries(${PROJECT_NAME} glew)

And when CLion try to compile the program with that code: -g tetris/CMakeFiles/Tetris_3D.dir/main.cpp.obj -o tetris\Tetris_3D.exe -Wl,--out-implib,tetris\libTetris_3D.dll.a -Wl,--major-image-version,0,--minor-image-version,0 D:/Projects/Tetris-3D/tetris/libs/GLFW/lib/libglfw3.a -lglew -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

I get the error: mingw32/bin/ld.exe: cannot find -lglew

0

There are 0 best solutions below