简体   繁体   中英

LNK1104 for unneeded library

I am trying to include the Boost Library in my OpenFrameworks project, in particular it is When I add the boost root directory to the Additional Include Directories of a new project, I see the error LNK1104 cannot open file 'libboost_filesystem-vc141-mt-gd-x32-1_72.lib' , although I don't even need the filesystem library.

However, when I added the boost root directory to the Additional Include Directories of a freshly create c++ console project, the error does not show, and I can make use of the library without problems.

Runtime Library is /MDd.

What might cause this problem? A broken build of boost?

One

Taken from the comments to the question. Although this is unusual it could be that a header in one of the dependencies of your project has the same name as a header in the filesystem library. And since you put boost first in the Additional Include Directories the boost header was included instead of a header from a different library. By default with Visual Studio boost automatically inserts link commands using a #pragma comment(lib, libname) so including this header will cause a link dependency.

A solution to try in this case is to move boost to the end of the Additional Include Directories so when the compiler searches for the header it will find the one from the previous dependency first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM