Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ CMake FLANN failing when building pcl in vs2012

Trying to build PCL on VS2012 in Windows 8.1 so I can attempt to integrate my Kinect for Windows v2 sensor with it, however I seem to be running into a bunch of CMake errors that I don't know what to do with. this is partially because I am not very familiar with CMake, and so I am following the tutorial here which outlines the building of dependencies using the CMake GUI. However, throughout this process I have found that the only things that have built properly are the ones I build using cmake in the command line. the errors are:

For FLANN:

When trying to build INSTALL in VS2012 (this isn't even getting into the other build errors, but lets start here) I get:

Error 21 error C2228: left of '.serialize' must have class/struct/union D:\flann-1.8.4-src\flann-1.8.4-src\src\cpp\flann\util\serialization.h line 18: type.serialize(ar); Error 24 error LNK1181: cannot open input file '..\lib\Release\flann.lib' D:\flann-1.8.4-src\flann-1.8.4-src\build\examples\LINK Error 25 error MSB3073: The command "setlocal C:\CMake\bin\cmake.exe -DBUILD_TYPE=Release -P cmake_install.cmake if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd :VCEnd" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets 134

For VTK:

the VTK_USE_QTOPENGL option is not appearing, even though I already first enable VTK_USE_QT, and project generation for VS2012 crashed a few times, but was able to move past the crashes (I worry that this doesn't bode well for actually using VTK)

For Qhull:

similar error as FLANN:

Error 1 error MSB3073: The command "setlocal C:\CMake\bin\cmake.exe -DBUILD_TYPE=Debug -P cmake_install.cmake if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd :VCEnd" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets 134

but the rest of it builds nicely. any advice would be welcome.

like image 838
physincubus Avatar asked Nov 06 '14 15:11

physincubus


1 Answers

I had similar issues building PCL with VS2012 in Windows 7.

This is how I solved: For all cases, before open Visual studio as administrator.

FLANN

  1. Use CMake and after click in "Configure", set the BUILD_PYTHON_BINDINGS and BUILD_MATLAB_BINDINGS to OFF.
  2. Click again in "Configure", then "Generate".
  3. Open the solucion file (with VS as administrator).
  4. Edit the file flann\src\cpp\flann\util\serialization.h adding after the statement BASIC_TYPE_SERIALIZER(...) (it is aprox in line #93) the following lines: #ifdef _MSC_VER BASIC_TYPE_SERIALIZER(unsigned __int64); #endif
  5. Build ALL_BUILD project and the INSTALL project, both in debug and release configuration.

QHUll

  1. Open CMake and before clicking on "Configure", click on "Add Entry" and fill the fields as follows: Name : CMAKE_DEBUG_POSTFIX Type : STRING Value : _d
  2. Then click "Ok".
  3. Click "Configure" twice and "Generate".
  4. Open the solution and build ALL_BUILD project and the INSTALL project, both in debug and release configuration.

VTK

  1. Open CMake and before clicking on "Configure", and if you didn't have the enviroment variables for Qt4.x manually locate: QT_QMAKE_EXECUTABLE to the location of qmake.exe QT_QTCORE_librery_RELEASE QT_QTCORE_LIBRARY_DEBUG QT_MKSPECIF_DIR
  2. Open the solution and build ALL_BUILD project and the INSTALL project, both in debug and release configuration.

Hope it works for you.

like image 196
rodrygojose Avatar answered Oct 24 '22 09:10

rodrygojose