2011-11-26 831 views
1

一直試圖找出一個小時。我擁有的是一個在Qt Creator中打開的簡單Qt項目。我想要做的是在我的Qt項目中使用SDL庫(dll)。如何在Qt項目中引用第三方dll /庫

在Visual Studio中,我會正常做的是使用VS工具爲此dll添加對此dll的引用。 Qt Creator中,我打開.pro文件爲我的項目,並增加了對性病的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 

然而,這似乎並沒有包含在Qt的圖書館爲我用一個LIB條目。當我編譯時,我仍然收到SDL.h: No such file or directory錯誤消息。希望得到任何幫助以解決這個問題,並可能爲未來學習,因爲我打算在開發工作中經常使用Qt。

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 

回答

0

試着這麼做:

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

+0

剛剛測試過,並沒有奏效。 – Kobojunkie

+1

@Kobojunkie:嘗試'LIBS + =「C:/Users/vata/Desktop/DskProj/Dsk-build-desktop/debug/SDL.dll」' –

+0

這也行不通。 – Kobojunkie

2

SDL.h是一個C頭文件,而不是庫。爲了讓編譯器找到它,你需要將它的目錄添加到qmake的INCLUDEPATH中。例如:

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

(提示:你可以使用/,而不是\獨善其身\可能解釋爲轉義字符的)。

相關問題