0

I am implementing a SLAM-algorithm in Visual Studio 2019 where I want to use the ICP algorithm from the MRPT library for scan-matching.

I installed the MRPT library as 32-bit from source code using CMake. Problem is the error I'm receiving when building the solution (shown below). I assume it is because I have not added Additional Library Directories or Additional Dependencies for the Linker, because I can't find the .lib/.dll files anywhere. I tried installing the 64-bit precompiled binaries for Windows, where I found the .lib-files inside a lib-folder which does not appear when compiling manually with the source code - but can't use the same lib's because I need 32-bit (I tried linking to them, but the same error occurred in addition a bunch of warnings that library is 64-bit and target is 32-bit).

The code is pretty much exactly the same as the first example here, with (I believe) all necessary headers included.

The error produced (I also receive many more of the same error for every class I attempt to use from the library):

particle.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mrpt::poses::CPose2D::CPose2D(double,double,double)" (__imp_??0CPose2D@poses@mrpt@@QAE@NNN@Z) referenced in function (function)

The quick question is: Shouldn't the .lib/.dll files be produced when compiling from source code as well? Or is there something embedded in the library so I don't need them, in which case there must be something else wrong?

The more complicated question is: If the missing .dll/.lib-files is not the problem, what could it be?

Sorry if I am missing any relevant information, this is my first post. Just let me know and I will provide.

Any help is greatly appreciated!

mullinsen
  • 1
  • 1
  • The error tells me that you are likely missing linking to an import library (meaning you did not add the setting in your project settings to instruct your linker to link to a dependent .lib file). ***all necessary headers included.*** This probably has nothing to do with headers. – drescherjm Mar 06 '20 at 14:17
  • ***I installed the MRPT library as 32-bit from source code using CMake.*** I think you did not complete this step correctly. – drescherjm Mar 06 '20 at 14:24
  • That's what I think too. As I said; problem is I can't find the import libraries when compiling MRPT from source code with CMake. I found them in 64-bit when installing precompiled binaries (I need 32-bit), so I believe a lib folder should have been included containing them, but it doesn't seem to be the case. – mullinsen Mar 06 '20 at 14:25
  • Did you get any errors when building the `CMake` generated `MRPT` project in Visual Studio? Did you build all configurations? – drescherjm Mar 06 '20 at 14:25
  • I followed the instructions given [here](https://www.mrpt.org/Building_and_Installing_Instructions#2_CMake_build_options). Did not edit any of the options in CMake which were not mentioned in the list there. – mullinsen Mar 06 '20 at 14:28
  • @drescherjm The only error I get when building the project in Visual Studio is the one I mentioned. Or is there any other MRPT project you mean? I didn't build all configurations, I left most of it at default except a couple of things I don't believe I need. – mullinsen Mar 06 '20 at 14:31
  • I don't mean building the example code. I mean building the `MRPT` library which is step 4 of the instructions you linked 2 comments ago. ***Just build as usual: from Visual Studio click on “Build all” for the targets you want to build (Debug or Release)*** – drescherjm Mar 06 '20 at 14:32
  • @drescherjm Sorry, I didn't know I had to explicitly build the library, I assumed it would build automatically when included (I am new to CMake, in case you didn't guess it). I built it now, with mulitple errors saying ´LNK1104 cannot open file '..\..\lib\Debug\libmrpt-slam157_msvc142_x32-dbg.lib'´. I assume this also indicates that the CMake has gone wrong something, since there is no lib-folder – mullinsen Mar 06 '20 at 14:41
  • @drescherjm Hold on, I see they are appearing as I build stuff. I will continue trying and come back to you if I can't solve it. – mullinsen Mar 06 '20 at 14:47
  • `CMake` configure and generate usually just generate the project files or makefiles for several different IDEs. This part usually does not build. – drescherjm Mar 06 '20 at 14:49
  • Sometimes a generated project needs to be built more than 1 time to succeed. – drescherjm Mar 06 '20 at 14:50
  • @drescherjm I keep getting errors, but they seem to be linked to functions which are deprecated/removed in C++17. Can I build this in another version of C++ and still use it in my project, which uses C++17? Or do I need to edit the files manually to work with C++17? – mullinsen Mar 06 '20 at 15:24
  • I can't answer that. You probably want to create a new question about that specific topic and add the text of the errors copied from the Output Tab of Visual Studio. – drescherjm Mar 06 '20 at 15:25
  • Allright, seems I got the answer to this specific question. Thank you very much! – mullinsen Mar 06 '20 at 15:28

0 Answers0