C++ ld:找不到架构 x86_64 (Xcode 4) 的符号 // opengles.o

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8014334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 17:51:02  来源:igfitidea点击:

ld: symbol(s) not found for architecture x86_64 (Xcode 4) // opengles.o

c++objective-cxcodeopenglopengl-es

提问by Olivier_s_j

I'm making an xcode command tool application with external libraries and got some errors.

我正在使用外部库制作 xcode 命令工具应用程序,但遇到了一些错误。

what i tried to resovle them :

我试图解决它们:

  • Build with different compiler
  • remove The GLES folder and add it again
  • Build it on 32 and 64
  • 使用不同的编译器构建
  • 删除 GLES 文件夹并再次添加
  • 在 32 和 64 上构建它

Am i missing something regarding the opengles.cpp ?

我是否遗漏了有关 opengles.cpp 的内容?

If you got any idea what can be done next please say so, below you can find all the info regarding the project and error. If you need more info i'm happy to assist you. Also if you know how to get the NiUsertracker sample from opnni compiled in xcode 4, it would also be a great help to solve this problem

如果您知道下一步可以做什么,请说出来,您可以在下面找到有关项目和错误的所有信息。如果您需要更多信息,我很乐意为您提供帮助。此外,如果您知道如何从在 xcode 4 中编译的 opnni 中获取 NiUsertracker 示例,这对解决此问题也将有很大帮助

The error :

错误 :

enter image description here

在此处输入图片说明

The problem might have something to do with these files :

问题可能与这些文件有关:

enter image description here

在此处输入图片说明

The info of the project setting (it's a command line tool not an app) :

项目设置的信息(它是一个命令行工具而不是一个应用程序):

enter image description here

在此处输入图片说明

Screenshot of the output when building

构建时输出的屏幕截图

enter image description here

在此处输入图片说明

The build settings

构建设置

enter image description here

在此处输入图片说明

回答by Bob

Usually when I get those kinds of errors, It's because I forgot to link with the library. The folder you got contains only headers; try to find the framework for OpenGL ES. (I think Xcode comes with a GLES framework, try searching.)

通常当我遇到这些类型的错误时,这是​​因为我忘记了与库的链接。你得到的文件夹只包含标题;尝试找到 OpenGL ES 的框架。(我觉得 Xcode 自带一个 GLES 框架,试着搜索一下。)

回答by chown

Run the commands manually in a terminal (Terminal.app) to find out exactly what the problem is:

在终端 (Terminal.app) 中手动运行命令以准确找出问题所在:

[ 11:56 jon@hozbox ~ ]$ Ld /Users/olivierjanssens/Library/Developer/Xcode/DerivedData/scene-anlidnesspxdbhblrrwqfwybphqj/Build/Products/Debug/scene normal x86_64
[ 11:56 jon@hozbox ~ ]$ cd /Users/olivierjanssens/Documents/xcode/scene
[ 11:56 jon@hozbox ~ ]$ setenv MACOSX_DEPLOYMENT_TARGET 10.7
[ 11:56 jon@hozbox ~ ]$ /Developer/usr/bin/llvm-g++-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/olivierjanssens/Library/Developer/Xcode/DerivedData/scene-anlidnesspxdbhblrrwqfwybphqj/Build/Products/Debug -L/Users/olivierjanssens/Documents/xcode/scene/Libs -F/Users/olivierjanssens/Library/Developer/Xcode/DerivedData/scene-anlidnesspxdbhblrrwqfwybphqj/Build/Products/Debug -filelist /Users/olivierjanssens/Library/Developer/Xcode/DerivedData/scene-anlidnesspxdbhblrrwqfwybphqj/Build/Intermediates/scene.build/Debug/scene.build/Objects-normal/x86_64/scene.LinkFileList -mmacosx-version-min=10.7 /usr/lib/libnimCodecs.dylib /usr/lib/libnimMockNodes.dylib /usr/lib/libnimRecorder.dylib /usr/lib/libOpenNI.dylib /usr/lib/libXnVFeatures.dylib /usr/lib/libXnVHandGenerator.dylib -framework GLUT -framework OpenGL /Users/olivierjanssens/Documents/xcode/scene/Libs/glut64.lib -o

After running the last command (/Developer/usr/bin/llvm-g++-4.2), it will show the reason for failing.

运行最后一个命令 ( /Developer/usr/bin/llvm-g++-4.2) 后,它将显示失败的原因。

If the setenv MACOSX_DEPLOYMENT_TARGET 10.7command fails, replace setenvwith exportand put an =before the 10.7like this:

如果setenv MACOSX_DEPLOYMENT_TARGET 10.7命令失败,请替换setenvexport并在=前面放置一个,10.7如下所示:

[ 11:56 jon@hozbox ~ ]$ export MACOSX_DEPLOYMENT_TARGET="10.7"


It seems like your missing a setting for your build configuration. Possibly the app name (MyApp.app). Check to make sure your not missing anything from the "Info" tab in the project settings window (just click the top item from the list of files on the left).

您似乎缺少构建配置的设置。可能是应用程序名称 (MyApp.app)。检查以确保您没有遗漏项目设置窗口中的“信息”选项卡中的任何内容(只需单击左侧文件列表中的顶部项目)。

From llvm-gcc man page:

llvm-gcc 手册页

-o filenameSpecify the output file to be filename.

-o filename指定输出文件为 filename。

回答by Tendulkar

remove the framework.And add it again.Quit the Xcode and relaunch it.

删除框架。然后再次添加它。退出 Xcode 并重新启动它。