문제

I am trying run Apple documentation sample code, placed on this link...

Sample Code

However when I run this code XCode fails to compile. It shows several error stating that below listed variables are not defined.

  • GL_COLOR_BUFFER_BIT
  • GL_VIEWPORT
  • GL_PROJECTION
  • GL_MODELVIEW
  • GL_QUADS

My understanding is, it is obvious that Xcode couldn't fins this const variables and it seems like they are from OpenGL framework. I checked my imported framework list it have OpenGL in it.

How to solve this?

Environment :

OS version              : MacOSX 10.7.3
Base SDK of the project : MacOSX SDK 10.7
Compiler                : Defualt LLVC GCC 4.2
도움이 되었습니까?

해결책

Just add

#import <OpenGL/gl.h>

to the file NormalGLView.m (at the top of the file, after the other import). That fixed it for me...

The problem was not that it couldn't find the framework, but it couldn't find the definitions, indicating that a header file might be missing

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top