2013-07-04 54 views
0

我一直在嘗試使用OpenNI和黑夜使用Qt,但我得到這個錯誤:鏈接OpenNI和黑夜使用Qt

C:\Users\User\Google Drive\Projects\Qt-Projects\untitled\mainwindow.cpp:3: error:  C1083: Cannot open include file: 'OpenNI2/Include/OpenNI.h': No such file or directory 

同樣與黑夜發生得。 我已經添加了庫與Qt Creator的添加庫接口,我檢查了存在的環境變量。 這是我的.pro文件:

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../OpenNI2/Lib/ - lOpenNI2 
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../OpenNI2/Lib/ -lOpenNI2d 

INCLUDEPATH += $$PWD/../../../../../../OpenNI2/Include/ 
DEPENDPATH += $$PWD/../../../../../../OpenNI2/Include/ 

win32:CONFIG(release, debug|release): LIBS += - L$$PWD/../../../../../../PrimeSense/NiTE2/Lib/ -lNiTE2 
else:win32:CONFIG(debug, debug|release): LIBS += - L$$PWD/../../../../../../PrimeSense/NiTE2/Lib/ -lNiTE2d 

INCLUDEPATH += $$PWD/../../../../../../PrimeSense/NiTE2/Include/ 
DEPENDPATH += $$PWD/../../../../../../PrimeSense/NiTE2/Include/ 

回答

1

這就解決了這個問題。

LIBS += -L$$PWD/../../../../../../OpenNI2/Lib/ -lOpenNI2 

INCLUDEPATH += $$PWD/../../../../../../OpenNI2/Include 
DEPENDPATH += $$PWD/../../../../../../OpenNI2/Include 

LIBS += -L$$PWD/../../../../../../PrimeSense/NiTE2/Lib/ -lNiTE2 

INCLUDEPATH += $$PWD/../../../../../../PrimeSense/NiTE2/Include 
DEPENDPATH += $$PWD/../../../../../../PrimeSense/NiTE2/Include 

但我現在有另一個問題。

在這樣的普通的C++應用程序運行完美:

#include <iostream> 

using namespace std; 

int main() 
{ 
    cout << "Hello World!" << endl; 
    return 0; 
} 

但這:

#include <iostream> 
#include "OpenNI.h" 
#include "NiTE.h" 

using namespace std; 
using namespace nite; 

int main() 
{ 
    cout << "Hello World!" << endl; 
    cout << NiTE::getVersion().build << endl; 
    return 0; 
} 

編譯和運行,但不提供任何輸出。我究竟做錯了什麼?

編輯:顯然我忘了將Redist文件夾中的內容複製到運行目錄。