我的 app.cpp:
#include "app.h"
#include <EGL/egl.h>
#include <EGL/eglext.h>
void
Java_com_geek_hello_FilterStack_nativeEglSetFenceAndWait(JNIEnv* env, jobject thiz) {
EGLDisplay display = eglGetCurrentDisplay();
// Create a egl fence and wait for egl to return it.
// Additional reference on egl fence sync can be found in:
// http://www.khronos.org/registry/vg/extensions/KHR/EGL_KHR_fence_sync.txt
EGLSyncKHR fence = eglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, NULL);
if (fence == EGL_NO_SYNC_KHR) {
return;
}
...
当我运行 ndk-build 时,它无法找到 egl.h 中存在的方法,并且没有创建 .so。这是日志:
app.cpp:31:72: error: 'eglCreateSyncKHR' was not declared in this scope
其次是属于的所有KHR方法
这是Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
#LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES
LOCAL_CFLAGS = -Wno-psabi
LOCAL_SRC_FILES := app.cpp
#LOCAL_SHARED_LIBRARIES := libcutils libEGL
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libapp
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv2
include $(BUILD_SHARED_LIBRARY)