Compiling with CMake for Visual Studio

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling with CMake for Visual Studio

Alex
Hello everyone, I am trying to compile RTABMap source code for Visual Studio using the Cmake GUI. I have followed the instructions shown here https://github.com/introlab/rtabmap/wiki/Installation#windows and successfully compiled the source code within the VS command prompt, but I would like to make a Visual studio solution so I could edit the code and make it work for Kinect v2 as it was mentioned at a previous topic in this forum.

I have (successfully?) managed to configure and generate a Visual Studio solution. The trick was to run cmake-gui on the visual studio command prompt so you would not have to worry about dependencies such as psabi and then make sure that you have the correct paths for pcl opencv etc.

The problem appears when I tried to build the solution within visual studio. I have manged to make it build successfully 19 out of the 21 solutions but I am having some errors. Particularly when trying to build rtabmap_core and rtabmap_gui

The errors are:
6>------ Rebuild All started: Project: rtabmap_core, Configuration: Release x64 ------
.
.
.
.
6>  [Creating resources]
6>  '..\..\..\bin\uresourcegenerator' is not recognized as an internal or external command,
6>  operable program or batch file.
6>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 9009.
6>
6>Build FAILED.

7>------ Rebuild All started: Project: rtabmap_gui, Configuration: Release x64 ------
.
.
.
7>Link:
7>     Creating library C:/CMakeTesting/rtabmap-master/lib/Release/rtabmap_gui.lib and object C:/CMakeTesting/rtabmap-master/lib/Release/rtabmap_gui.exp
7>  Touching "rtabmap_gui.dir\Release\rtabmap_gui.unsuccessfulbuild".
MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class cv::Mat __cdecl rtabmap::util3d::create2DMapFromOccupancyLocalMaps(class std::map<int,class rtabmap::Transform,struct std::less<int>,class std::allocator<struct std::pair<int const ,class rtabmap::Transform> > > const &,class std::map<int,struct std::pair<class cv::Mat,class cv::Mat>,struct std::less<int>,class std::allocator<struct std::pair<int const ,struct std::pair<class cv::Mat,class cv::Mat>
.
.
.
(lines after lines of errors)
.
.
.
========== Rebuild All: 19 succeeded, 2 failed, 0 skipped ==========

I am using Visual Studio 2010 in windows 8 x64. And I have build it on the Release mode

Any help would be greatly appreciated.

Cheers
Alex
Reply | Threaded
Open this post in threaded view
|

Re: Compiling with CMake for Visual Studio

matlabbe
Administrator
Hi Alex,

The problem was that uresourcegenerator is supposed to be found in the bin directory and not the "bin/Release" (or "bin/Debug") directory. I fixed the main CMakeLists.txt so binaries are created in "bin".

Cheers,
Mathieu

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with CMake for Visual Studio

Alex
Yes! that was the issue. It works now thank you very much.

Cheers,
Alex