android c++ undefined reference to eglGetCurrentContext
android c++ undefined reference to 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 库......
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- C++ Singleton - Prevent ::instance() to variable
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- Visual Studio Code "undefined reference to `WinMain@16'"
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 如何解决"invalid conversion from 'char' to 'const char*'"
- 使用 MATLAB 编码器生成C++代码:编译错误"undefined reference to `rgb2gray_tbb_real64'"
- 尝试链接我的着色器时,我收到错误代码"error c5145 must write to gl_position"
- Python str to C++ to Python str
- 为什么创建友元类的实例会导致"undefined reference to"错误?
- System.InvalidCastException - SQL to C++ - safe_cast<float>
- 使用 cmake 的 Linux 终端上的"Conversion to non-scalar type is requested"错误
- "no matching function for call to 'Vector::Vector'"错误
- vector<vector<double>> to mxArray using memcpy
- Tensorflow c++ api undefined reference to 'tflite::D efaultErrorReporter()'
- 当覆盖存在时调用基本虚拟"binded to object"函数
- OpenGL VBO Indexing ( How to compute Index Array)
- 为什么我会" void value not ignored as it ought to be"?
- C++:如何将 unix 时间的字符串转换为 *tm?(使用时间错误:"cannot convert 'String' to 'tm*' ")