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 ?
精彩评论