0

I'm trying to link opengl32 to my project through cmake. I tried

set(LIBS "opengl32.dll" "${CMAKE_CURRENT_SOURCE_DIR}/vendor/GLFW/include")
target_link_libraries(${PROJECT_NAME} ${LIBS})

but when I tried to run the program, it gives me unresolved external symbol _glfwInit referenced in function ...

genpfault
  • 51,148
  • 11
  • 85
  • 139
Thomas
  • 169
  • 10
  • What is the compiler? With msvc / Visual Studio you don't link dlls you link the `.lib` (import library) that goes with the dll. – drescherjm Jul 01 '21 at 20:47
  • `set(LIBS "opengl32.dll" "${CMAKE_CURRENT_SOURCE_DIR}/vendor/GLFW/include")` line seems quite odd when passed to `target_link_libraries(${PROJECT_NAME} ${LIBS})` the include folder has nothing to do with linking. – drescherjm Jul 01 '21 at 20:48
  • Your CMakeLists.txt should be similar to this: [https://stackoverflow.com/a/64952671/487892](https://stackoverflow.com/a/64952671/487892) – drescherjm Jul 01 '21 at 21:05

0 Answers0