Search code examples
boostvisual-studio-2013linker-errorscaffeicc

link error for library which doesn't exist in Linker->Input


I'm compiling Berkley's Caffe to a static library, MT, MSVC 12 (VS2013) and linking it to a dll.
It works fine.
Now I'm trying to compile it with Intel C++ 2015 compiler - the static lib build fine, but the dependent dll fails with the following linker error:

fatal error LNK1104: cannot open file 'libboost_thread-iw-mt-s-1_58.lib'

There isn't such library in my Boost build indeed, but I don't know where this dependency came from. Except for the compiler I didn't change any other setting, and I can't find that Boost lib in either Caffe of my dll's Linker->Input->Additional dependencies.
How can I fix this?
Thanks!


Solution

  • Found the solution here: https://software.intel.com/en-us/articles/intel-c-compiler-for-windows-fatal-link-error-lnk1104-when-using-intel-c-compiler-with-boost-libraries

    Copied:

    When building an application that uses the Boost libraries with the Intel® C++ Compiler, you may get linker errors like the ones shown below due to incorrect libraries being linked to the application:

    fatal error LNK1104: cannot open file 'libboost_thread-iw-mt-1_33_1.lib' fatal error LNK1104: cannot open file 'libboost_thread-iw-1_33_1.lib' ... The root cause is missing Boost libraries for the Intel® C++ Compiler.

    The preferred solution is to recompile all required Boost libraries with the Intel® C++ Compiler (libraries with the infix "iw" are created because of this). However, this is not mandatory. The libraries provided for the different Microsoft Visual Studio* versions are safe to use as well. Perform the following steps to use them instead:

    Open the Boost configuration file "auto_link.hpp". Search for 1

    elif defined(__ICL) 2 3 4

                           // Intel C++, no version number: 5   6
                        #  define BOOST_LIB_TOOLSET "iw" Change "iw" depending on which Microsoft Visual Studio version you're using:
    

    "vc71": Microsoft Visual Studio .NET 2003 "vc80": Microsoft Visual Studio 2005 "vc90": Microsoft Visual Studio 2008 "vc100": Microsoft Visual Studio 2010 "vc110": Microsoft Visual Studio 2012 "vc120": Microsoft Visual Studio 2013 "vc140": Microsoft Visual Studio 2015

    Rebuild your application to resolve the linker errors.