使用GLFW和X code问题:不会编译 [英] Problems using GLFW and XCode : won't compile

查看:149
本文介绍了使用GLFW和X code问题:不会编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用C编写了一段时间,但现在我来到GLFW和OpenGL,一切顺心。

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

我使用OSX雪豹和X code,用gcc编译。

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

我添加到项目中的以下框架,以确保一切都在那里:可可的OpenGL,GLUT,AGL和碳

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

在X code,我把下的头搜索路径:的/ usr /本地/包括

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

和我下的库搜索路径放:的/ usr / local / lib目录的/ usr / local / lib目录/ pkgconfig /Users/Arkady/Desktop/glfw-2.7.2/lib (我知道这可能是太多,但似乎GCC找不到功能...)。

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...).

编译时,我得到5错误:

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

我还没有忘记把的#include< GL / glfw.h方式> 在code

我现在已经在互联网上搜索了两个小时,这是不够的。我真的希望你会带给我的答案:我怎么忘了给GCC让他找不到的功能

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?

推荐答案

这是一个链接错误,你有你的程序与GLFW库链接。

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

这篇关于使用GLFW和X code问题:不会编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆