6

I'm writing a program which utilizes Boost logging features and consequently, when attempting to build the said program, I'm getting the following error when generating code (on Visual Studio 2017):

1>LINK : fatal error LNK1104: cannot open file 'libboost_log-vc141-mt-gd-1_64.lib'

However, I can confirm the following:

  • boost_1_64_0\stage\lib has been added to "Additional Library Directories" under Linker -> General
  • libboost_log-vc141-mt-gd-1_64.lib is located under stage/lib since when unpacking Boost, I did a complete build with toolset set to 14.1
  • following relevant question's answers, I did add the specific .lib to "Additional Dependencies" under Linker -> Input

I feel like it's something obvious that I am missing. But, any help would be much appreciated.

Dash
  • 306
  • 1
  • 3
  • 16
  • 4
    Are you mixing 32 and 64 bit? – drescherjm Jun 02 '17 at 16:17
  • Set the `Tools->Options`, `Projects and Solutions->Build and Run`, `MSBuild project build log verbosity` to `Diagnostic`. Build your project. Examine the log in your intermediate output folder and search for the boost library name and the link command line it uses. – Khouri Giordano Jun 02 '17 at 16:17
  • building knight online sources? – L F Mar 30 '22 at 02:31

2 Answers2

5

drescherjm was correct, I was mixing 32 and 64 bit. Needed to change Target Machine under Project Configuration Properties -> Linker -> Advanced to MACHINEX86 and it worked.

Thank you!

Dash
  • 306
  • 1
  • 3
  • 16
0

For me, I was using the below define for linking log libraries in order to use dynamically. I removed it and worked.

//#define BOOST_LOG_DYN_LINK 1 // necessary when linking the boost_log library dynamically
Mahmut EFE
  • 5,137
  • 5
  • 46
  • 56