How to use eglext.h methods (eglGetStreamFileHandlerKHR)

Hey there! I’m working on a project that requires me to use an EGLNativeFileDescriptorKHR so that one egl producer can provide frames to a consumer on a separate process. I’m developing on an Nvidia Jetson NX.

I seem to be having a problem with including the methods from eglext.h. When I include eglext, I can declare variables like EGLNativeFileDescriptorKHR, but I can’t use the methods associated with them like eglGetStreamFileHandlerKHR even though they are declared in eglext.h. The compiler complains that the methods are undefined.

I read from a forum for android developers using EGL that you need to define the prototypes like so:

#define EGL_EGLEXT_PROTOTYPES //before #include <eglext.h>
#include <egl.h>
#include <eglext.h>

I’m writing in C++ but I couldn’t find any other documentation as to how to make it compile so I tried it anyway, and everything compiled! But then I had the linker error. It seems that linking with -lEGL wasn’t enough for the extensions library but I can’t seem to find the right flag to successfully link! Has anyone had any success with compiling, linking and running with the EGL extensions? Any examples and tips would be greatly appreciated.

If I manage to find anything while digging through example source code, I’ll be sure to post it here so the answers can be found in the future. Thanks!