How to use kinect API functions inside CUDA programming


I am a newbie to CUDA programming.Since i like CUDA very much, i like to display kinect depth data,skeleton data and video data in CUDA. IF i include kinect header files inside .cu file, it is throwing the following error.

identifier “IUnknown” is undefined.

Error 57 error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe” -gencode=arch=compute_20,code=“sm_20,compute_20” --use-local-env --cl-version 2012 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64” -IE:\Spirans.3DViewPort\Wrapper -I"C:\Program Files\Microsoft SDKs\Kinect\v2.0-PublicPreview1409\inc” -IE:\Win32Project1\multisensors -I"D:\Program Files\PCL 1.7.2\3rdParty\Boost\include\boost-1_56\boost" -I"E:\Win32Project1\multisensors\glfw-3.1.1.bin.WIN64\glfw-3.1.1.bin.WIN64\include" -IE:\Win32Project1\multisensors\oscpack -I"C:\Program Files\PCL 1.7.2\3rdParty\Eigen\eigen3" -I"C:\Program Files\PCL 1.7.2\include\pcl-1.7" -I"C:\Program Files\PCL 1.7.2\3rdParty\Boost\include\boost-1_56" -I"C:\Program Files\PCL 1.7.2\3rdParty\FLANN\include" -I"C:\Program Files\PCL 1.7.2\3rdParty\QHull\include" -I"C:\Program Files\PCL 1.7.2\3rdParty\VTK\include\vtk-6.1" -I"C:\freeglut-2.8.1\freeglut-2.8.1\include\GL" -I"C:\freeglut-2.8.1\freeglut-2.8.1\include" -I"C:\Program Files (x86)\Visual Leak Detector\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -DWIN32 -D_DEBUG -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS -D_UNICODE -DUNICODE -Xcompiler “/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o x64\Debug\ “E:\3DViewPort28-3\3DViewPort\Win32Project1\”” exited with code 2. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\CUDA 7.5.targets 604 9 3DViewPort

Please help me to solve this error and able to see my kinect depth data in CUDA.


I have no experience with the Kinect SDK, but generally the preprocessing steps for .cu to separate device and host code tend to interfere with using other libraries.

I always separate CUDA code from non-CUDA functionality (user interface etc), compile them separately and link them together afterwards. This also makes it a lot easier to produce non-CUDA versions from the same source code.

Maybe someone on the forum has more specific experience with Kinect however.

A quick remedy might be to put all Kinect-related #includes inside “#ifndef CUDA_ARCH” . That way they are only included into the separated-out host code (as they are useless in device code anyway).

Thanks for your answers.

As per your suggestion i have also included kinect header files inside #ifndef CUDA_ARCH, still it throws the same error.

From your answer , i have understood that kinect sdk functionality could not be included in CUDA coding.

If i understood correctly,whether i have to convert all my kinect code to pure C++ code and then should i include it with CUDA coding.

I have couple of doubts regarding .cu files.

  1. Whether all C++ variables,statements and methods will be supported by .cu files.
  2. Can i use C++ int,float and string arrays inside .cu files.
  3. What are the datatypes supported by .cu files.
  4. What will be the alternate to include Kinect sdk datatypes inside .cu files.