Using OpenNI in Qt Creator

2,192 views
Skip to first unread message

Niek

unread,
Feb 11, 2011, 8:53:21 AM2/11/11
to OpenNI
Hello, Im new to programming with OpenNI. I am trying to create a
Kinect application with OpenNI in Qt Creator for my Master Thesis. A
requirement is that it has to be platform independent as some people
at the group use macs instead of windows notebooks. Qt seems to be the
best at creating platform independent GUI's in C++ and comes with its
own IDE. However this IDE uses the mingw compiler instead of the MSVC
compiler. I have looked around with google and it seems as some people
are capable of creating OpenNI with Qt projects.

I really appreciate it if someone could help me.

The only thing I did was include XnCppWrapper.h to see whether the
linker would give problems. This gives a shitload of problems for me,
as I am not capable of compiling the code. There are a great deal of
errors, but the first I want to address these two:

1) ../../../Program Files/OpenNI/Include/XnPlatform.h:57:26: error:
#error Xiron Platform Abstraction Layer – Win32 – Microsoft Visual
Studio versions below 2003 (7.0) are not supported!

from this code:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

#if defined(_WIN32) // Microsoft Visual Studio
#ifndef RC_INVOKED
#if _MSC_VER < 1300 // Before MSVC7 (2003)
#error Xiron Platform Abstraction Layer -
Win32 - Microsoft Visual Studio versions below 2003 (7.0) are not
supported!
#endif

#if _MSC_VER > 1600 // After MSVC8 (2010)
#error Xiron Platform Abstraction Layer - Win32 - Microsoft Visual
Studio versions above 2010 (10.0) are not supported!
#endif
#endif

#include "Win32/XnPlatformWin32.h"
#elif (linux && (i386 || __x86_64__))
#include "Linux-x86/XnPlatformLinux-x86.h"
#elif (linux && __arm__)
#include "Linux-Arm/XnPlatformLinux-Arm.h"
#elif (__APPLE__)
#include "MacOSX/XnPlatformMacOSX.h"
#else
#error OpenNI Platform Abstraction Layer - Unsupported Platform!
#endif

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

The second problem is:

2) ../../../Program Files/OpenNI/Include/Win32/XnPlatformWin32.h:
59:20: error: crtdbg.h: No such file or directory

As far as I can tell the problem is that Qt Creator does not use the
MSVC compiler and thus stumbles over all the pre-processor code in the
headers. Also crtdbg.h is something that is implicitly used by Visual
Studio, but not Qt Creator. Is there something I can do or add to my
code in that it works fine. I have looked around on google to see
whether someone else had my problem, but everyone there has different
problems and my problem does not seems to be an issue.

Last, there are some macro's that the compiler cannot find. As they
are not declared in the scope. Well this the compile output:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Running build steps for project DataProcessor...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/local/NiekHoeijmakers/
Project_Repository/KinectProject-build-desktop'
c:\qt\2010.04\qt\bin\qmake.exe -spec ..\..\..\..\Qt\2010.04\qt\mkspecs
\win32-g++ -win32 -o Makefile ..\DataProcessor\DataProcessor.pro
mingw32-make: Leaving directory `C:/local/NiekHoeijmakers/
Project_Repository/KinectProject-build-desktop'
mingw32-make: Entering directory `C:/local/NiekHoeijmakers/
Project_Repository/KinectProject-build-desktop'
C:/Qt/2010.04/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/local/NiekHoeijmakers/
Project_Repository/KinectProject-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -
DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -
DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\2010.04\qt
\include\QtCore" -I"..\..\..\..\Qt\2010.04\qt\include\QtGui" -I"..\..
\..\..\Qt\2010.04\qt\include" -I"..\DataProcessor\include" -I"..\..\..
\..\Program Files\OpenNI\Include" -I"..\..\..\..\Program Files\OpenNI
\Include\Win32" -I"..\..\..\..\Qt\2010.04\qt\include\ActiveQt" -
I"debug" -I"." -I"..\DataProcessor" -I"." -I"..\..\..\..\Qt\2010.04\qt
\mkspecs\win32-g++" -o debug\main.o ..\DataProcessor\src\main.cpp
In file included from ..\..\..\..\Program Files\OpenNI\Include/
XnStatus.h:29,
from ..\..\..\..\Program Files\OpenNI\Include/XnTypes.h:31,
from ..\..\..\..\Program Files\OpenNI\Include/XnOpenNI.h:31,
from ..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:32,
from ..\DataProcessor\include/DataProcessor.h:18,
from ..\DataProcessor\src\main.cpp:2:
..\..\..\..\Program Files\OpenNI\Include/XnPlatform.h:57:26: error:
#error Xiron Platform Abstraction Layer - Win32 - Microsoft Visual
Studio versions below 2003 (7.0) are not supported!
In file included from ..\..\..\..\Program Files\OpenNI\Include/
XnPlatform.h:65,
from ..\..\..\..\Program Files\OpenNI\Include/XnStatus.h:29,
from ..\..\..\..\Program Files\OpenNI\Include/XnTypes.h:31,
from ..\..\..\..\Program Files\OpenNI\Include/XnOpenNI.h:31,
from ..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:32,
from ..\DataProcessor\include/DataProcessor.h:18,
from ..\DataProcessor\src\main.cpp:2:
..\..\..\..\Program Files\OpenNI\Include/Win32/XnPlatformWin32.h:
59:20: error: crtdbg.h: No such file or directory
In file included from ..\DataProcessor\include/DataProcessor.h:18,
from ..\DataProcessor\src\main.cpp:2:
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4770:76:
error: macro "XN_VALIDATE_NEW" passed 4 arguments, but takes just 2
In file included from ..\DataProcessor\include/DataProcessor.h:18,
from ..\DataProcessor\src\main.cpp:2:
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In
constructor 'xn::OutputMetaData::OutputMetaData(const XnUInt8**)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:214: warning:
'xn::OutputMetaData::m_nAllocatedSize' will be initialized after
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:208: warning:
'XnUInt8* xn::OutputMetaData::m_pAllocatedData'
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:93: warning:
when initialized here
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnUInt32 xn::MapMetaData::BytesPerPixel() const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:294: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnDepthPixel& xn::DepthMap::operator[](XnUInt32)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:404: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnDepthPixel& xn::DepthMap::operator[](XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:404: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnDepthPixel& xn::DepthMap::operator()(XnUInt32,
XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:404: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnDepthPixel& xn::DepthMap::operator()(XnUInt32,
XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:404: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnUInt8& xn::ImageMap::operator[](XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:405: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnUInt8& xn::ImageMap::operator[](XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:405: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnUInt8& xn::ImageMap::operator()(XnUInt32, XnUInt32)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:405: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnUInt8& xn::ImageMap::operator()(XnUInt32, XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:405: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnRGB24Pixel& xn::RGB24Map::operator[](XnUInt32)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:406: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnRGB24Pixel& xn::RGB24Map::operator[](XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:406: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnRGB24Pixel& xn::RGB24Map::operator()(XnUInt32,
XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:406: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnRGB24Pixel& xn::RGB24Map::operator()(XnUInt32,
XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:406: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnGrayscale16Pixel& xn::Grayscale16Map::operator[]
(XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:407: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnGrayscale16Pixel& xn::Grayscale16Map::operator[]
(XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:407: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnGrayscale16Pixel& xn::Grayscale16Map::operator()
(XnUInt32, XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:407: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnGrayscale16Pixel& xn::Grayscale16Map::operator()(XnUInt32,
XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:407: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnGrayscale8Pixel& xn::Grayscale8Map::operator[]
(XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:408: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnGrayscale8Pixel& xn::Grayscale8Map::operator[]
(XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:408: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnGrayscale8Pixel& xn::Grayscale8Map::operator()
(XnUInt32, XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:408: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnGrayscale8Pixel& xn::Grayscale8Map::operator()(XnUInt32,
XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:408: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnIRPixel& xn::IRMap::operator[](XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:409: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnIRPixel& xn::IRMap::operator[](XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:409: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnIRPixel& xn::IRMap::operator()(XnUInt32, XnUInt32)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:409: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnIRPixel& xn::IRMap::operator()(XnUInt32, XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:409: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnLabel& xn::LabelMap::operator[](XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:410: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnLabel& xn::LabelMap::operator[](XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:410: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnLabel& xn::LabelMap::operator()(XnUInt32, XnUInt32)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:410: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnLabel& xn::LabelMap::operator()(XnUInt32, XnUInt32)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:410: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnDepthPixel& xn::DepthMetaData::operator[](XnUInt32)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:503: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnDepthPixel& xn::DepthMetaData::operator()(XnUInt32,
XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:515: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnLabel& xn::SceneMetaData::operator[](XnUInt32)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:913: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'const XnLabel& xn::SceneMetaData::operator()(XnUInt32,
XnUInt32) const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:925: error:
'_ASSERTE' was not declared in this scope
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In
constructor 'xn::EnumerationErrors::EnumerationErrors()':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4103: warning:
'xn::EnumerationErrors::m_bAllocated' will be initialized after
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4102: warning:
'XnEnumerationErrors* xn::EnumerationErrors::m_pErrors'
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4003: warning:
when initialized here
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In
constructor
'xn::EnumerationErrors::EnumerationErrors(XnEnumerationErrors*,
XnBool)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4103: warning:
'xn::EnumerationErrors::m_bAllocated' will be initialized after
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4102: warning:
'XnEnumerationErrors* xn::EnumerationErrors::m_pErrors'
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4011: warning:
when initialized here
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In member
function 'XnStatus xn::NodeInfo::GetInstance(xn::ProductionNode&)
const':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4612: warning:
unused variable 'nRetVal'
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h: In static
member function 'static XnStatus
xn::StateChangedCallbackTranslator::RegisterToUnderlying(XnStatus (*)
(XnInternalNodeData*, void (*)(XnInternalNodeData*, void*), void*,
void**), XnInternalNodeData*, void (*)(xn::ProductionNode&, void*),
void*, void*&)':
..\..\..\..\Program Files\OpenNI\Include/XnCppWrapper.h:4770: error:
'XN_VALIDATE_NEW' was not declared in this scope
mingw32-make[1]: Leaving directory `C:/local/NiekHoeijmakers/
Project_Repository/KinectProject-build-desktop'
mingw32-make: Leaving directory `C:/local/NiekHoeijmakers/
Project_Repository/KinectProject-build-desktop'
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" exited with
code %2.
Error while building project DataProcessor (target: Desktop)
When executing build step 'Make'

gamix

unread,
Feb 11, 2011, 3:04:49 PM2/11/11
to OpenNI
Hello Niek,

First of all it seems that you are using a very old version of Visual
Studio. Visual Studio 2003 was definitely not compliant to the C++
standard so the OpenNi code is unlike to build there and you would
certainly not any support for using Qt with that version. Consider
installing the latest version of Visual studio Express which is free.
The Express version is fully functional, but the only difference with
the professional version is that the compiler does not optimize you
code much and that does not support Add-ins (Qt in fact has its own
add it)

When you go on the Qt web site there are two distinct pre-built
versions for Windows: one for MinGW and the other for Visual Studio.
So, If you want to use Visual Studio you have to install the other
version! Beware though that the Qt binaries are built for VS2008 (last
time I checked at least), so they may not work if you have VS2010
[Express]. For VS2010, you should build the library yourself following
these instructions:

(1) start a Visual Studio 2010 command prompt (which has the correct
compilation environment, instead of the usual command line).
(2) go to the top-level directory of your qt installation
(3) run: "configure -debug-and-release -platform win32-msvc2010"
(4) run: "nmake"

This only works with Qt version > 4.7!

Secondly consider that if you a .pro file for Qt creator you can
convert it to a Visual Studio project by:

(1) start the Visual Studio command prompt (which has the correct
compilation environment, instead of the usual command line).
(2) navigate to the directory containing you .pro file
(3) type "qmake -t vcapp"

At this point you should have a working Visual Studio project ready to
use.

Both Qt and C++ are standard C++ libraries, so if you configured your
system correctly and have a decent compiler (not MSVC2003!) you should
not have any problem.

-gamix

Niek

unread,
Feb 12, 2011, 9:42:05 AM2/12/11
to OpenNI
Hello gamix,

Thanks for your reply. I really appreciate your help. However you are
incorrect in thinking that I am using Visual Studio 2003. In fact I do
not have it installed at all. Like I stated, I used Qt Creator. And Qt
Creator uses the MinGW compiler. I could not find out how I could
switch compilers in Qt Creator, thus I made the switch to Visual
Studio 2010 with the Qt Addin.

I have installed VS C++ 2008 Express and VS C++ 2010 Express. But
somehow Qt did not want to setup with those. Thus now I installed
Visual Studio 2010 and followed these instructions to set it up:
http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/

It worked and now I am trying to get the things I already done in Qt
Creator over to Visual Studio.
- I loaded the .pro file with Qt -> Open Qt Project File
- Added the additional includes and libraries of Qt to the project.
- And tried to compile it.

Compiling did not work and resulted in the error below. Which suggests
to me that Qt's MOC does not connect with Visual Studio's compiler.
Maybe I am missing something in my project, like a pre-build command
or an include directory for source and headers.

----------------------------------------------------------------------------------------------------------------------------------------------------------------
1>------ Build started: Project: DataProcessor, Configuration: Debug
Win32 ------
1>Build started 12-2-2011 15:39:50.
1>InitializeBuildStatus:
1> Touching "C:\local\NiekHoeijmakers\Project_Repository\KinectProject
\DataProcessor\..\DataProcesor-interim\Debug
\DataProcessor.unsuccessfulbuild".
1>CustomBuild:
1> Moc'ing include\DataProcessor.h...
1> moc: Too many input files specified
1> Usage: moc [options] <header-file>
1> -o<file> write output to file rather than stdout
1> -I<dir> add dir to the include path for header files
1> -E preprocess only; do not generate meta object
code
1> -D<macro>[=<def>] define macro, with optional definition
1> -U<macro> undefine macro
1> -i do not generate an #include statement
1> -p<path> path prefix for included file
1> -f[<file>] force #include, optional file name
1> -nw do not display warnings
1> @<file> read additional options from file
1> -v display version of moc
1> Moc'ing include\mainwindow.h...
1> UIC resources\Forms\mainwindow.ui
1> Rcc'ing resources\Icons\icons.qrc...
1>ClCompile:
1> moc_DataProcessor.cpp
1>c1xx : fatal error C1083: Cannot open source file: 'Debug
\moc_DataProcessor.cpp': No such file or directory
1> moc_mainwindow.cpp
1> mainwindow.cpp
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(3279): warning C4100:
'bState' : unreferenced formal parameter
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(4612): warning C4189:
'nRetVal' : local variable is initialized but not referenced
1>src\mainwindow.cpp(2): fatal error C1083: Cannot open include file:
'ui_mainwindow.h': No such file or directory
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.90
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========


--------------------------------------------------------------------------------------------------------------------------------------------------------
> ...
>
> meer lezen »

Niek

unread,
Feb 12, 2011, 10:36:59 AM2/12/11
to OpenNI
Okay, I what caused it, but my error changed. I have been making
changes in the project option to separate the generated files by
Visual Studio from the source files I programmed myself. I also
changed some things in the Qt Add-in so that the generated files are
grouped in a single directory. Now my error has changed to a Linker
error.
--------------------------------------------------------------------------------------------------------------------------------------

1>------ Build started: Project: DataProcessor, Configuration: Debug
Win32 ------
1>Build started 12-2-2011 16:30:59.
1>InitializeBuildStatus:
1> Touching "C:\local\NiekHoeijmakers\Project_Repository\KinectProject
\DataProcessor\..\DataProcessor-interim\Debug
\DataProcessor.unsuccessfulbuild".
1>ComputeCustomBuildOutput:
1> Creating directory "C:\local\NiekHoeijmakers\Project_Repository
\KinectProject\DataProcessor\GeneratedFiles\Debug\".
1>CustomBuild:
1> Moc'ing include\DataProcessor.h...
1> Moc'ing include\mainwindow.h...
1> Uic'ing resources\Forms\mainwindow.ui...
1> Rcc'ing resources\Icons\icons.qrc...
1>MakeDirsForCl:
1> Creating directory "C:\local\NiekHoeijmakers\Project_Repository
\KinectProject\DataProcessor\debug".
1>ClCompile:
1> moc_DataProcessor.cpp
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(3279): warning C4100:
'bState' : unreferenced formal parameter
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(4612): warning C4189:
'nRetVal' : local variable is initialized but not referenced
1> moc_mainwindow.cpp
1> main.cpp
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(3279): warning C4100:
'bState' : unreferenced formal parameter
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(4612): warning C4189:
'nRetVal' : local variable is initialized but not referenced
1> mainwindow.cpp
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(3279): warning C4100:
'bState' : unreferenced formal parameter
1>C:\Program Files\OpenNI\Include\XnCppWrapper.h(4612): warning C4189:
'nRetVal' : local variable is initialized but not referenced
1> Generating Code...
1> qrc_icons.cpp
1>LINK : fatal error LNK1104: cannot open file '\.obj'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:04.17
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

--------------------------------------------------------------------------------------------------------------------------------------

On 12 feb, 15:42, Niek <n.j.hoeijmak...@student.utwente.nl> wrote:
> Hello gamix,
>
> Thanks for your reply. I really appreciate your help. However you are
> incorrect in thinking that I am using Visual Studio 2003. In fact I do
> not have it installed at all. Like I stated, I used Qt Creator. And Qt
> Creator uses the MinGW compiler. I could not find out how I could
> switch compilers in Qt Creator, thus I made the switch to Visual
> Studio 2010 with the Qt Addin.
>
> I have installed VS C++ 2008 Express and VS C++ 2010 Express. But
> somehow Qt did not want to setup with those. Thus now I installed
> Visual Studio 2010 and followed these instructions to set it up:http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-wit...
> ...
>
> meer lezen »

gamix

unread,
Feb 12, 2011, 5:42:55 PM2/12/11
to OpenNI
Niek: my apologies, I misinterpreted your error logs! I am using Qt
with OpenNI and I also recently helped several people get Qt up an
running, and in one case the main source of the problem was in fact
the use of an ancient compiler.

Did you ever get any Qt project to compile on your machine? What
happens, if you create a simple Qt application in Qt Creator or with
the Visual Studio Add-In? Does it ever build successfully? If not,
then it means that Qt was not configured correctly on your machine.
Try uninstalling Qt (removing the corresponding environment variables
as well) and re-install.

Also, make sure that MinGW or Visual Studio (whichever you prefer) are
configured correctly. What happens if you try to build a simple hello
world application?

The errors that you get do not seem to be related to OpenNI, so if you
get Qt to work correctly, you should be able to add OpenNI to your
project easily.

Lastly, consider that Visual Studio project files generated by QMake
are very messy and it is very difficult to modify them by hand without
breaking the build. My suggestion is to always configure your project
correctly in the .pro file, so that the generated Visual Studio
project works out-of-the-box the way you want without modification

-gamix
> ...
>
> read more »

Niek

unread,
Feb 13, 2011, 7:17:53 AM2/13/11
to OpenNI
Thanks for your help. I got it all to compile, link and run without a
problem now. My last problem was in the linker's additional
dependencies. Apparently, for me the out-of-the-box conversion went
completely wrong. Instead of adding the actual libraries of OpenNI to
the list of dependencies the conversion process added the paths to the
libraries. For the rest I had to check whether the correct include
directories were added for the Qt generated files. Because I'm kind of
a neat freak I setup everything so that final output files, original
source and intermediate files each got separated in their own
directory. And for Qt I made it that all the generated files were put
under their own directory under the source files.

> The errors that you get do not seem to be related to OpenNI, so if you
> get Qt to work correctly, you should be able to add OpenNI to your
> project easily.

I was wondering about it. My problem was with both aspects, but when I
asked over at Qt they immediatly treated as "not their problem" and
never got a decent answer.
> ...
>
> meer lezen »
Reply all
Reply to author
Forward
0 new messages