1

Been trying to figure this out for an hour now. What I have is a simple Qt Project open in Qt Creator. What I would like to do is use the SDL library (dll) with my Qt project.

In visual Studio, what I would normall do is add a reference to this dll using VS tool that provides for that. In Qt creator, I opened the .pro file for my project, and added a LIB entry for the STD dll

# Add more folders to ship with the application, here
folder_01.source = qml/BoxGame
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01

# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =

symbian:TARGET.UID3 = 0xEED812B5

# Smart Installer package's UID
# This UID is from the protected range and therefore the package will
# fail to install if self-signed. By default qmake uses the unprotected
# range value if unprotected UID is defined for the application and
# 0x2002CCCF value if protected UID is given to the application
#symbian:DEPLOYMENT.installer_header = 0x2002CCCF

# Allow network access on Symbian
symbian:TARGET.CAPABILITY += NetworkServices

# If your application uses the Qt Mobility libraries, uncomment the following
# lines and add the respective components to the MOBILITY variable.
# CONFIG += mobility
# MOBILITY +=
LIBS  +=  C:\Users\vata\Desktop\DskProj\Dsk-build-desktop\debug\SDL.dll


# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp \
    blockboxes.cpp \
    block.cpp \
    boxengine.cpp \
    boxgame.cpp \
    point.cpp \
    gamecontroller.cpp \
    gamecontrollermod.cpp

# Please do not modify the following two lines. Required for deployment.
include(qmlapplicationviewer/qmlapplicationviewer.pri)
qtcAddDeployment()

HEADERS += \
    blockboxes.h \
    block.h \
    boxengine.h \
    boxgame.h \
    Globals.h \
    point.h \
    gamecontroller.h \
    gamecontrollermod.h \
    controller.h

However, that does not seem to include the Library in Qt for my use. When I compile, I still get an SDL.h: No such file or directory error message. Would appreciate any help in figuring this out and probably learning for the future as I intend to use Qt more often than not for my development work.

Running build steps for project Tetris...
Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe" clean
C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug clean
NG_
  • 6,895
  • 7
  • 45
  • 67
Kobojunkie
  • 6,375
  • 31
  • 109
  • 164

2 Answers2

2

SDL.h is a C header file, not a library. For the compiler to find it, you need to add its directory to qmake's INCLUDEPATH. For example:

INCLUDEPATH += C:/Dir/Where/SDL/Headers/Are/Found

(Tip: you can use / instead of \ to stay clear of possible interpretations of \ as an escape character.)

Nikos C.
  • 50,738
  • 9
  • 71
  • 96
0

Try something like:

LIBS += -LC:\\Users\\vata\\Desktop\\DskProj\\Dsk-build-desktop\\debug -lsdl

Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • 1
    @Kobojunkie: try `LIBS += "C:/Users/vata/Desktop/DskProj/Dsk-build-desktop/debug/SDL.dll"` – Violet Giraffe Nov 26 '11 at 22:11
  • 1
    @Kobojunkie: I'm sorry, I didn't read your question attentively at first. Are you still getting "SDL.h: No such file or directory"? If so, you should add `ICLUDEPATH` to the SDL includes in your .pro file – Violet Giraffe Nov 27 '11 at 06:14