Problems using GLFW and XCode : won't compile

Deadly 提交于 2019-12-12 05:11:58

问题


I have been programming in C for a while, but now I come to GLFW and OpenGL and everything goes wrong.

I am using OSX Snow Leopard and XCode, compiling with GCC.

I added to the project the following frameworks to be sure everything is there : Cocoa, OpenGL, GLUT, AGL and Carbon.

Under XCode, I put under the Header search paths: /usr/local/include

And I put under the Library search paths : /usr/local/lib, /usr/local/lib/pkgconfig and /Users/Arkady/Desktop/glfw-2.7.2/lib (I know it is probably too much, but it seems GCC can't find the functions...).

When compiling, I get 5 errors :

Undefined symbols:
  "_glfwSwapBuffers", referenced from:
      _glfemPlotReshape in glfem.o
  "_glfwOpenWindow", referenced from:
      _glfemInit in glfem.o
  "_glfwInit", referenced from:
      _glfemInit in glfem.o
  "_glfwSetWindowSizeCallback", referenced from:
      _glfemInit in glfem.o
  "_glfwSetWindowTitle", referenced from:
      _glfemInit in glfem.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I haven't forgot to put the #include <GL/glfw.h> in the code.

I have now been searching for two hours on the Internet, it's enough. I really hope you will bring me the answer : what did I forget to give GCC so that he cannot find the functions?


回答1:


This is a linker error, you have to link your program with the glfw libraries.

See Link with the right libraries here

http://www.glfw.org/docs/latest/build.html#build_link



来源:https://stackoverflow.com/questions/9250961/problems-using-glfw-and-xcode-wont-compile

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!