我有一个 OpenGL ES 2.0 应用程序,想在 View Controller 实现中使用 C++ 代码。但是,将文件扩展名更改为 mm 后(或者甚至只是调整源类型而不更改文件名),在链接过程中遇到以下错误:
架构 armv7 的 undefined symbol :
"_GLKMatrix4Identity", referenced from: GLKMatrix4MakeTranslation(float, float, float) in GameViewController.o
"_OBJC_METACLASS_$_GLKViewController", referenced from: _OBJC_METACLASS_$_GameViewController in GameViewController.o
"_OBJC_CLASS_$_GLKViewController", referenced from: _OBJC_CLASS_$_GameViewController in GameViewController.o
"_GLKMatrix3InvertAndTranspose", referenced from: -[GameViewController update] in GameViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
欢迎提出任何建议。
最佳答案
我在构建阶段设置中手动添加了 GLKit 框架。 (虽然有趣的问题 - 为什么在不涉及 C++ 源时应用程序不需要它 - 它怎么可能编译和运行?)
关于c++ - 将源文件类型更改为 Objective-C++ 后的链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27217728/