1

我一直在尝试将 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/
4

1 回答 1

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

于 2013-07-04T20:20:19.243 回答