我从 C++ 中的 OpenGL 开始,我在我的 XCode 项目中包含了 GLUT 和 OpenGL 框架。当我尝试编译和运行我的程序时,就好像它是一个简单的 C++ 程序一样,它给了我这个错误:
Undefined symbols for architecture x86_64:
"_glBegin", referenced from:
display() in main.o
"_glClear", referenced from:
display() in main.o
"_glClearColor", referenced from:
etc.
使用简单的 C++ 程序,我没有遇到任何此类错误。我在网上搜索了一下,发现我需要用 g++(特定于 c++ 语言)进行编译,但我不知道该怎么做。有帮助吗?
最佳答案
您需要将 -framework OpenGL
添加到您的编译器设置中。
关于c++ - 在 XCode 5 上编译 g++?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19482784/