android - android c++ 未定义对 eglGetCurrentContext 的引用
问题描述
我正在尝试在 C++ 中获取 android 上的当前 OpenGL 上下文。
但我得到一个编译时错误,我怎样才能得到当前的上下文?
错误:
undefined reference to eglGetCurrentContext()
编码:
#include <GLES2/gl2.h>
#include <EGL/egl.h>
void foo()
{
EGLContext ctx = eglGetCurrentContext();
}
解决方案
您的 make 文件库列表中缺少 libEGL。
假设您使用的是 CMake 文件,您的 make 文件中需要这样的内容:
# Include libraries needed
target_link_libraries(
GLESv2
EGL)
GLESv2
此错误不需要注意,但鉴于您包含 GLES2 标头,您可能在某些时候需要 GLESv2 库...
推荐阅读
- bash - 从命令行执行浏览器搜索
- c# - JSON 值无法转换为 System.Byte[]
- angular - mat-toolbar 未与 mat-grid-list 一起显示
- flutter - Navigator pushReplacementNamed 在 Flutter 应用程序中加载屏幕两次
- python - 在多个条件下迭代 pandas 数据框
- c# - C# - for 循环如何理解以下语法及其工作原理?
- ruby-on-rails - 是否为每个终端选项卡缓存本地文件?
- javascript - 错误:模板解析错误:找不到管道“currencySeparator”
- jquery - 如何检查两个图像是否存在然后做其他事情
- android - 如何在 Android Studio 的活动底部制作 Android xml Linerlayout?