我想画的OpenGL为二维空间,我做以下,但它不会编译:在Mac上
int vPort[4];
glGetIntegerv(GL_VIEWPORT, vPort);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrthof(0, vPort[2], 0, vPort[3], -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
我已经包括OpenGL.framework框架,编译器跟踪说以下。
In function '-[OpenGLView drawRect:]':
warning: implicit declaration of function 'glOrthof'
Ld build/Debug/OpenGLTest1.app/Contents/MacOS/OpenGLTest1 normal x86_64
/Developer/usr/bin/gcc-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk - L/Users/user/Documents/cocoa/OpenGLTest1/build/Debug -F/Users/user/Documents/cocoa/OpenGLTest1/build/Debug -filelist /Users/user/Documents/cocoa/OpenGLTest1/build/OpenGLTest1.build/Debug/OpenGLTest1.build/Objects-normal/x86_64/OpenGLTest1.LinkFileList -mmacosx-version-min=10.6 -framework Cocoa -framework OpenGL -o /Users/user/Documents/cocoa/OpenGLTest1/build/Debug/OpenGLTest1.app/Contents/MacOS/OpenGLTest1
Undefined symbols:
"_glOrthof", referenced from:
-[OpenGLView drawRect:] in OpenGLView.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
我已经用完了关于如何修复它的想法。我的目标是目前的桌面应用程序,但我的目标是最终创建一个iPhone应用程序。
你是如何包含框架的?这里是示例https://www.youtube.com/watch?v=3FdVLJT12d4 – Sergei 2016-11-01 12:12:57