Skip to content Skip to sidebar Skip to footer

Gl.h & Glext.h Not Found

While trying to execute a program based on C++ in android via NDK platform, the compilation is giving error that 'gl.h' and 'glext.h' header files are not found, as I have included

Solution 1:

Not quite sure, but I believe if you looking into the sample code provided by google ndk, it could be a great help.

the sample code located at

    android-ndk-r7b\samples\hello-gl2\jni\gl_code.cpp

If compare the Android.mk, you will find your

    LOCAL_LDLIBS    := -llog -lGLESv2

is missing. The Android.mk provided by Google is looks like below:

    LOCAL_PATH:= $(call my-dir)include$(CLEAR_VARS)

    LOCAL_MODULE    := libgl2jni
    LOCAL_CFLAGS    := -Werror
    LOCAL_SRC_FILES := gl_code.cpp
    LOCAL_LDLIBS    := -llog -lGLESv2

    include$(BUILD_SHARED_LIBRARY)

and also, in the cpp source code, android is using :

#include<GLES2/gl2.h>#include<GLES2/gl2ext.h>

Solution 2:

There is no such thing as #import in C/C++. Also you need to increase APP_PLATFORM level. OpenGL ES 1 is available only stating from android-4 and OpenGL ES 2 is available from android-5. It's all in the documentation: docs/STABLE-APIS.html file.

Solution 3:

I think you were trying to build in the jni directory. Try again in the root directory of the Android project.

Solution 4:

Do not know if this issue is still common. I just had this issue and found one solution. It turned out the file "Application.mk" was needed in the "jni" directory.

This is my "Application.mk":

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-14

I think "APP_PLATFORM := android-14" informed Android of using Opengl ES. In fact, "APP_PLATFORM := android-5" is the minimum requirement for OpenGL 2.x.

Post a Comment for "Gl.h & Glext.h Not Found"