openglsuperbible/sb6code

Linker error (Ubuntu 16.04) - undefined reference to `glfwInit'

Opened this issue · 1 comments

I am unable to get even the basics running in Ubuntu 16.04. I've also tried to edited the CMakeLists.txt according to #24 but the linker still complains

[  4%] Built target sb6
[  5%] Linking CXX executable bin/wrapmodes
CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o: In function `sb6::application::run(sb6::application*)':
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x30): undefined reference to `glfwInit'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x89): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x9f): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xae): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xbd): undefined reference to `glfwOpenWindowHint'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xd3): undefined reference to `glfwOpenWindowHint'
CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o:wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xfd): more undefined references to `glfwOpenWindowHint' follow
CMakeFiles/wrapmodes.dir/src/wrapmodes/wrapmodes.cpp.o: In function `sb6::application::run(sb6::application*)':
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x13b): undefined reference to `glfwGetDesktopMode'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x193): undefined reference to `glfwOpenWindow'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1b1): undefined reference to `glfwSwapInterval'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1f1): undefined reference to `glfwOpenWindow'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x231): undefined reference to `glfwSetWindowTitle'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x23b): undefined reference to `glfwSetWindowSizeCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x245): undefined reference to `glfwSetKeyCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x24f): undefined reference to `glfwSetMouseButtonCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x259): undefined reference to `glfwSetMousePosCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x263): undefined reference to `glfwSetMouseWheelCallback'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x27a): undefined reference to `glfwEnable'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x281): undefined reference to `glfwDisable'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x292): undefined reference to `glfwGetWindowParam'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x376): undefined reference to `glfwGetTime'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x384): undefined reference to `glfwSwapBuffers'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x38e): undefined reference to `glfwGetKey'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3ae): undefined reference to `glfwGetWindowParam'
wrapmodes.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3e8): undefined reference to `glfwTerminate'
lib/libsb6.a(gl3w.c.o): In function `open_libgl':
gl3w.c:(.text+0xf): undefined reference to `dlopen'
lib/libsb6.a(gl3w.c.o): In function `close_libgl':
gl3w.c:(.text+0x2c): undefined reference to `dlclose'
lib/libsb6.a(gl3w.c.o): In function `get_proc':
gl3w.c:(.text+0x47): undefined reference to `glXGetProcAddress'
gl3w.c:(.text+0x68): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
CMakeFiles/wrapmodes.dir/build.make:95: recipe for target 'bin/wrapmodes' failed
make[2]: *** [bin/wrapmodes] Error 1
CMakeFiles/Makefile2:131: recipe for target 'CMakeFiles/wrapmodes.dir/all' failed
make[1]: *** [CMakeFiles/wrapmodes.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Anyone any ideas how to fix this? Thanks!

Meet the same problem TAT.