Error: Type 'EGL_DEFAULT_DISPLAY' could not be resolved when tried to use Open GL purely in C++ NativeActivity in NDK

StackOverflow https://stackoverflow.com/questions/22143794

  •  19-10-2022
  •  | 
  •  

Question

Can anyone suggest how start learning Open GL implementation in pure C++ in a NativeActivity in Android NDK without using jni.

I have tried running the sample NativeActivity that comes with the NDK setup, but I am not able to run it. Giving error

Type 'EGL_DEFAULT_DISPLAY' could not be resolved

Can anyone suggest how to resolve this error.

Was it helpful?

Solution

Resolved the error

just add the statement typedef void* EGLNativeDisplayType; before the statement #include <EGL/egl.h> in main.c in the NativeActivity

OTHER TIPS

Can be handled by including source SUB directories as well as their parents in project > properties >C/C++ General > Paths and Symbols > Includes(tab).

e.g. add

${env_var:ANDROID_NDK}/platforms/android-19/arch-arm/usr/include/EGL

as well as

${env_var:ANDROID_NDK}/platforms/android-19/arch-arm/usr/include

Maybe the syntax parser (if there is such a thing) misses the sub-folders?

include the ${env_var:ANDROID_NDK}/platforms/android-19/arch-arm/usr/include/EGL is a partial correct, after this, comment out all content in Application.mk, then close main.c, clean the project, open main.c again, see the error is disappear, then recovery the Application.mk.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top