Question

I've been trying to use OpenNI and NiTE with Qt but I get this error:

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

The same happens with NiTE too. I've added the libraries with Qt Creator's add library interface and I checked the existence Environment Variables. Here's my .pro file:

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/
Was it helpful?

Solution

This solves the problem.

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

But I have another problem now.

In a plain C++ application like this runs perfectly:

#include <iostream>

using namespace std;

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

But this:

#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;
}

compiles and runs but doesn't give any output. What am I doing wrong?

EDIT: Apparently I forgot to copy the contents from the Redist folder to the running directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top