Linker errors while trying to use <SDL_opengl.h>

Post Reply
Posts: 1
Joined: Sat Dec 25, 2021 11:06 pm

Linker errors while trying to use <SDL_opengl.h>

Post by brammie15 » Sat Jun 15, 2024 1:44 pm


I'm truing to use OpenGL with SDL in a project for the Switch,
I can get SDL to build / run on it. But when i try to use fucntions from SDL_opengl.h it causes linker errors.

Here is the code of what i am trying to build,
And here is the error i keep getting

Code: Select all

linking application.elf
/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.1.0/../../../../aarch64-none-elf/bin/ld: main.o: in function `main':
/home/bart/Downloads/application/source/main.cpp:76:(.text.startup.main+0xb0): undefined reference to `glMatrixMode'
collect2: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/libnx/switch_rules:81: /home/bart/Downloads/application/application.elf] Error 1
make: *** [Makefile:171: build] Error 2
I have looked at the Opengl examples and tried to also add the libs from opengl but to no avail

Any help?

Posts: 16
Joined: Tue Jun 01, 2010 11:02 am
Location: Germany

Re: Linker errors while trying to use <SDL_opengl.h>

Post by Tenry » Mon Jul 15, 2024 3:53 am

It appears the symbol glmatrixMode is not available in the library. You can check it using the nm command on libGLESv2.a:

Code: Select all

cd /opt/devkitpro/portlibs/switch/lib && nm libGLESv2.a | grep glMatrixMode
As far as I can tell this method is related to a legacy OpenGL with "immediate mode", which is not (fully) supported here, I believe. Instead, you should work with shaders and set matrices as uniforms using the

Code: Select all


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest