2014-04-12 9 views
5

So bauen ich die superbible 6. Auflage bekam, und ich versuche, den Beispielcode Rahmen cmake und machen, aber diese Fehlermeldung erhalten:Probleme versuchen opengl superbible Beispielcode

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 

Was bin ich? Soweit ich das beurteilen kann, habe ich bereits alle Abhängigkeiten installiert.

+0

Ziemlich viel, anscheinend. Eventuell müssen Sie '-ldl' hinzufügen, damit' dlopen' aufgelöst wird, '-lGL' für' glXGetProcAddress'. Ich gebe zu, ich weiß nicht das erste, was CMake betrifft, ich benutze immer noch gmake, also konnte ich dir nicht sagen, wie ich diese Linker-Flags hinzufügen soll. Wie für die GLFW Zeug, implizieren die Namen GLFW2. Sind Sie sicher, dass Sie GLFW3 nicht installiert haben und gedacht haben, dass es Ihre Abhängigkeiten befriedigen würde? Sie sind nicht kompatibel, viele Dinge haben sich geändert. –

+0

Yeah ... Dieses Zeug scheint die feindliche Lernkurve zu haben. C++ ist nicht nur eine epische Sprache an sich, sondern sogar all die Dinge, die es in Bezug auf das Kompilieren und Verknüpfen von Dateien und Makefiles und Headern und so weiter umgibt, ist ... irrsinnig. –

Antwort

1

als @AndonMColeman vorgeschlagen, Sie -lGL und -ldlam Ende müssen der Bibliotheken Liste. Verwenden Sie dafür das Makro target_link_libraries.

Wenn Sie CMakeLists.txt aus Ihrem Projekt zur Verfügung stellen würde es viel einfacher, Ihnen eine genaue Zeichenfolge vorschlagen/ändern hinzuzufügen;)