Issue
On Fedora, my command g++ main.cpp
sdl2-config --cflags -lSDL2main -lSDL2
thinks that the SLD2main
library is not available. It's right: other SDL2 libraries are in /usr/lib64
; libSDL2main.so
is not.
But I installed all apparently relevant SDL2 rpm's. Here's what the system tells me when I say yum install SDL2
:
Package SDL2-2.0.12-1.fc32.x86_64 is already installed.
Package SDL2-devel-2.0.12-1.fc32.x86_64 is already installed.
Package SDL2_image-2.0.5-3.fc32.x86_64 is already installed.
Package SDL2_image-devel-2.0.5-3.fc32.x86_64 is already installed.
Package SDL2_mixer-2.0.4-5.fc32.x86_64 is already installed.
Package SDL2_mixer-devel-2.0.4-5.fc32.x86_64 is already installed.
Package SDL2_ttf-2.0.15-4.fc32.x86_64 is already installed.
Package SDL2_ttf-devel-2.0.15-4.fc32.x86_64 is already installed.
If I take the g++ option -lSDL2main
out, the program links and runs.
But this is a problem. I want my Makefile to work on Unix systems generally. How can I do this -- use the same Makefile for RedHat/Fedora and Debian/Ubuntu?
Solution
You should be getting the linker flags from sdl2-config --libs
, or pkg-config sdl2 --libs
.
Answered By - HolyBlackCat Answer Checked By - Clifford M. (WPSolving Volunteer)