Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trouble trying to build opengl superbible example code

So I got the superbible 6th edition, and am trying to cmake and make the example code framework, but get this error:

Scanning dependencies of target sb6
[  1%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6.cpp.o
[  2%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6ktx.cpp.o
[  3%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6object.cpp.o
[  5%] Building CXX object CMakeFiles/sb6.dir/src/sb6/sb6shader.cpp.o
[  6%] Building C object CMakeFiles/sb6.dir/src/sb6/gl3w.c.o
Linking CXX static library lib/libsb6.a
[  6%] Built target sb6
Scanning dependencies of target alienrain
[  7%] Building CXX object CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o
Linking CXX executable bin/alienrain
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x21): undefined reference to `glfwInit'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x7a): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x90): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x9f): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xae): undefined reference to `glfwOpenWindowHint'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xc4): undefined reference to `glfwOpenWindowHint'
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o:alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0xee): more undefined references to `glfwOpenWindowHint' follow
CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function `sb6::application::run(sb6::application*)':
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x12c): undefined reference to `glfwGetDesktopMode'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x18e): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1a8): undefined reference to `glfwSwapInterval'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x1f2): undefined reference to `glfwOpenWindow'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x22e): undefined reference to `glfwSetWindowTitle'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x238): undefined reference to `glfwSetWindowSizeCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x242): undefined reference to `glfwSetKeyCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x24c): undefined reference to `glfwSetMouseButtonCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x256): undefined reference to `glfwSetMousePosCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x260): undefined reference to `glfwSetMouseWheelCallback'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x277): undefined reference to `glfwEnable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x27e): undefined reference to `glfwDisable'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x28f): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x373): undefined reference to `glfwGetTime'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x393): undefined reference to `glfwSwapBuffers'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x39d): undefined reference to `glfwGetKey'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3bd): undefined reference to `glfwGetWindowParam'
alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x3f5): 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+0x2b): undefined reference to `dlclose'
lib/libsb6.a(gl3w.c.o): In function `get_proc':
gl3w.c:(.text+0x45): undefined reference to `glXGetProcAddress'
gl3w.c:(.text+0x66): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/alienrain] Error 1
make[1]: *** [CMakeFiles/alienrain.dir/all] Error 2
make: *** [all] Error 2

What am I missing? As far as I can tell I have all the dependencies installed already.

like image 792
Anonymous Entity Avatar asked Apr 12 '14 00:04

Anonymous Entity


1 Answers

There is a bug in CMakeLists.txt at line 13. (https://github.com/openglsuperbible/sb6code/blob/master/CMakeLists.txt)

Change "elif (UNIX)" to "elseif (UNIX)",and it will be ok.

Reference: https://www.opengl.org/discussion_boards/showthread.php/183902-SuperBible-6th-ed-Cannot-link-the-Linux-examples

like image 62
chcby Avatar answered Oct 01 '22 14:10

chcby