The type "EGL_DEFAULT_DISPLAY" cannot be resolved while the constant is well defined

I am working on native Android 2.3.3 software. I copied the code from the code samples, I have a set of paths, but Eclipse (Indigo) still can't find this constant.

EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); //Type 'EGL_DEFAULT_DISPLAY' could not be resolved

      

However, the compiler does not catch the error:

Compile++ thumb  : NativeTest <= NativeTest.cpp

      

Any ideas why?

+3


source to share


2 answers


This error is due to the fact that Eclipse does not have __ ANDROID__ definition, which prevents EGLNativeDisplayType from being defined in EGL / eglplatform.h, which also does not define EGL_DEFAULT_DISPLAY.

To fix this, go to your projects properties and go to the C / C ++ General-> Paths and Symbols page, in the Symbols tab click on GNU C and then the Add button and put



__ANDROID__

      

in the feild name and click OK. You can do the same for GNU C ++.

+8


source


You can also add:

 typedef void* EGLNativeDisplayType;

      



before turning on egl.h.

+1


source







All Articles