Closed ghost closed 3 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:
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.
yes exactly
Fixed by #148
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.
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.
I built and installed the Eigen3 library successfully at C:/Eigen
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).
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:
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.
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.
After trying to install WITH _FGT = ON again, the same linking error still occurred.