Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GL_COLOR_BUFFER_BIT and many more show "undeclared identifier by Xcode

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
like image 477
TeaCupApp Avatar asked Jan 16 '23 13:01

TeaCupApp


1 Answers

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

like image 131
Bjoern Avatar answered Jan 31 '23 01:01

Bjoern