将OpenNI和NiTE与Qt联系起来

时间:2013-07-04 10:34:24

标签: linker kinect openni

我一直在尝试将OpenNI和NiTE用于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

NiTE也是如此。 我已经使用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 个答案:

答案 0 :(得分:2)

这解决了这个问题。

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文件夹中的内容复制到正在运行的目录。