0

I'm working on VS2017, i create a C++ Google Test project. I add the includes directories in C/C++ → General → Additional Include Directories.

Then i added libraries in Properties → Linker → Input and their directories in Properties → Linker → General → Additional Library Directories.

My project compiles fine, but when i build i got 'LNK1104' error for 'libboost_thread-vc140-mt-1_63.lib'.

Among added libraries, these are all boost lib :

  • boost_chrono-vc140-mt-1_63.lib
  • boost_date_time-vc140-mt-1_63.lib
  • boost_filesystem-vc140-mt-1_63.lib
  • boost_log_setup-vc140-mt-1_63.lib
  • boost_log-vc140-mt-1_63.lib
  • boost_program_options-vc140-mt-1_63.lib
  • boost_regex-vc140-mt-1_63.lib
  • boost_system-vc140-mt-1_63.lib
  • boost_thread-vc140-mt-1_63.lib

To begin whith is there a difference between the lib name in Linker 'boost_thread-vc140-mt-1_63.lib' and the lib name from the error 'libboost_thread-vc140-mt-1_63.lib'

I checked the documentation for third-party library, all directories and the configuration but i still can't resolve the problem.

Alan Birtles
  • 32,622
  • 4
  • 31
  • 60
Jaziri Rami
  • 147
  • 1
  • 12
  • You should link `boost_thread-vc140-mt-1_63.lib` then. – user7860670 Apr 09 '20 at 18:14
  • that's what i did, i added it the input Linker and i specify the path – Jaziri Rami Apr 09 '20 at 18:25
  • *I use the configuration x64 Release – Jaziri Rami Apr 09 '20 at 18:26
  • Maybe `libboost_thread-vc140-mt-1_63.lib` is linked from the code with `#pragma comment`? – user7860670 Apr 09 '20 at 18:28
  • `boost_thread-vc140-mt-1_63.lib` is the dll version, `libboost_thread-vc140-mt-1_63.lib` is the static library. Looks like you've ended up building or downloading the shared library version of boost, either build/download the static version or use the `#defines` in the linked duplicate to tell boost you want to use the shared libraries – Alan Birtles Apr 09 '20 at 18:45
  • @AlanBirtles thanks, i worked whith Preprocessor, i add BOOST_ALL_DYN_LINK and BOOST_ALL_NO_LIB . And these resolved the Bosst issue. Besides, i still got some LNK2019 errors ; for example LNK2019: unresolved external symbol "__declspec(dllimport) public: class testing::internal::String . I add these #defines GTEST_HAS_PTHREAD=0 and GTEST_LINKED_AS_SHARED_LIBRARY but it didn't work (it's a GoogleTest project) – Jaziri Rami Apr 09 '20 at 21:40
  • https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix have you linked the gtest libraries? I don't think they link themselves automatically like boost does – Alan Birtles Apr 10 '20 at 06:17
  • @AlanBirtles yes i linked the directories, i think that the problem comes from creating a GoogleTest project and linking it to a directory that contains gtest.lib and other .lib of my project (i'm working on a complicated project that contains many dependencies) maybe there is a conflict between the gtest.lib that exist and the one from Microsoft.googletest.v140 native – Jaziri Rami Apr 10 '20 at 09:14
  • you don't just need to add the directories, you also need to add the libraries, boost does this for you, gtest doesn't – Alan Birtles Apr 10 '20 at 10:55

0 Answers0