c++ - 在 XCode 5 上编译 g++?

标签 c++ xcode opengl g++

我从 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/

相关文章:

c++ - 如何正确(但有效地)实现类似 "vector::insert"的东西? (指针别名)

c++ - 在 dlsym 之后调用 dlclose 是否安全

ios - 如何使用按钮打开 View

c++ - OpenGL:如何在 3D 模式下优化多个图层相互重叠的 2D 渲染?

multithreading - QGLWidget的paintGL()方法从哪个Qt线程调用?

c++ - 如何正确包含 wxObjArray?

c++ - RAII 和堆栈展开

ios - Push Segue 的奇怪错误

ios - 颠倒的方向不会旋转到纵向

c++ - 使 Sprite 居中还是移动相机? C++/Opengl