1
General / OpenGl Tutorial Compile Issues
« on: November 12, 2019, 12:29:41 am »
I'm following https://www.sfml-dev.org/tutorials/2.5/window-opengl.php for opengl and I fail to compile it.
Debian 10
sfml installed via apt install libsfml-dev
g++ -c main.cpp
g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
john@d10cave:~/github/dxf2plasma/cpp/openGl$ g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
/usr/bin/ld: main.o: undefined reference to symbol 'glViewport'
/usr/bin/ld: //lib/x86_64-linux-gnu/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
From the tutorial
How does one "know" what OpenGl library they have?
JT
Debian 10
sfml installed via apt install libsfml-dev
g++ -c main.cpp
g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
john@d10cave:~/github/dxf2plasma/cpp/openGl$ g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
/usr/bin/ld: main.o: undefined reference to symbol 'glViewport'
/usr/bin/ld: //lib/x86_64-linux-gnu/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
From the tutorial
Quote
You will then need to link your program to the OpenGL library. Unlike what it does with the headers, SFML can't provide a unified way of linking OpenGL. Therefore, you need to know which library to link to according to what operating system you're using ("opengl32" on Windows, "GL" on Linux, etc.).
How does one "know" what OpenGl library they have?
JT