gadomski / cpd

C++ implementation of the Coherent Point Drift point set registration algorithm.
http://www.gadom.ski/cpd
GNU General Public License v2.0
385 stars 122 forks source link

Linking error when using Cpd with Fgt on Windows with shared libs #135

Closed ghost closed 3 years ago

ghost commented 6 years ago

I'm currently working on a project for my bachelor program. For that, I'm using a Windows 10 64-bit OS, Visual Studios 15 2017 and CMake 3.10.1 (C compiler: MSVC 19.12.25831.0).

In order to use Cpd with Fgt I did the following steps.

  1. I built and installed the Eigen3 library successfully at C:/Eigen

  2. I built, installed and tested the Fgt library successfully at C:/fgt-master, using default setting of CMake and BUILD_SHARED_LIBS = OFF, gtest_force_shared_crt = ON (as recommended).

  3. I tried to build, install and test Cpd, using default settings of CMake and WITH_FGT = ON, BUILD_SHARED_LIBS = ON, however building ALL_BUILD fails due to a linking error during all tests:

    LNK1104: cannot open file 'Fgt::Library-C++-NOTFOUND.obj'.

  4. I tried the same, but using several different constellation of settings in CMake instead (for example: BUILD_SHARED_LIBS = OFF, gtest_force_shared_crt = ON, etc). The same error occured every time.

  5. Next thing I did, was testing whether only building, installing and testing Cpd works or not. So I tried it with BUILD_SHARED_LIBS = OFF, gtest_force_shared_crt = ON / BUILD_SHARED_LIBS =
    ON, gtest_force_shared_crt = OFF and it successfully build, installed and tested the Cpd library. Furthermore I included the Library in my own project with Find_Package( Cpd REQUIRED ) and target_link_libraries ( CpdTest PRIVATE Cpd::Library-C++ ) and I could debug my test programm of Cpd successfully.

  6. After trying to install WITH _FGT = ON again, the same linking error still occurred.

ghost commented 6 years ago

I don't know how but after several tries of different constellations, it worked. The settings of CMake it worked with were the following ones:

gadomski commented 6 years ago

So it seems like dynamic linking doesn't work out of the box, but static linking does? @FlorianHermes if you can confirm, I'll change the name of this issue.

ghost commented 6 years ago

yes exactly

hobu commented 3 years ago

Fixed by #148

Boruson commented 3 years ago

thank you very much for your help!

------------------ 原始邮件 ------------------ 发件人: "gadomski/cpd" <notifications@github.com>; 发送时间: 2020年11月30日(星期一) 晚上10:15 收件人: "gadomski/cpd"<cpd@noreply.github.com>; 抄送: "洪荒少女~"<213893306@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [gadomski/cpd] Linking error when using Cpd with Fgt on Windows with shared libs (#135)

Closed #135.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.