开发者

QT SDL Not Recognized (Have Qmake File listed. Am I doing it wrong?)

开发者 https://www.devze.com 2023-04-01 12:20 出处:网络
Here is my qmake file. For whatever reason, when I try to compile the program SDL isn\'t being recognized. Why is this?

Here is my qmake file. For whatever reason, when I try to compile the program SDL isn't being recognized. Why is this?

LIBS += -L/usr/include/SDL.h -lSDL

HEADERS += \
    render.h \
    scree开发者_如何转开发nwriter.h

SOURCES += \
    screenwriter.cpp \
    render.cpp


It seems SDL uses pkgconfig:

$ repoquery -l SDL-devel | fgrep .pc
/usr/lib/pkgconfig/sdl.pc
/usr/lib64/pkgconfig/sdl.pc

So the best way to link with it would be to use link_pkgconfig, instead of adding it manually to LIBS:

CONFIG += link_pkgconfig
PKGCONFIG += sdl

This will automatically modify QMAKE_CXXFLAGS, QMAKE_CFLAGS, and LIBS for you, by calling pkg-config --cflags sdl and pkg-config --libs sdl.


Have you tried

`sdl-config --libs` 

instead of -lSDL ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号