Linker error LNK1104 with 'libboost_filesystem-vc100-mt-s-1_49.lib'

前端 未结 5 1841
我寻月下人不归
我寻月下人不归 2020-12-12 22:34

During the process of linking my program to the boost::filesystem module in release mode I get the next error:

error LNK1104: cannot open file \'libboost

相关标签:
5条回答
  • 2020-12-12 22:53

    You can paste the following characters into you control console (win+r----cmd , then go to boost src directory , find the bjam.exe) ps:double click the bootstrap.bat can get bjam.exe

    bjam --toolset=msvc-1.0 --stagedir=./lib_x64 --builddir=./ address-model=32 link=static variant=release runtime-link=static threading=multi stage debug releasde
    
    
    libboost_filesystem-vc100-mt-s-1_49.lib
    
    
    "link=static" correspond to -s-
    "threading=multi" correspond to -mt-
    "runtime-link=static" correspond to lib prefix
    "variant=release" make sure libboost_filesystem-vc100-mt-s-1_49.lib don't contain -gd-
    
    0 讨论(0)
  • 2020-12-12 22:55

    You are using /MT or /MTd option in C/C++/Code Generation/Runtime Library which require static library, boost default build with shared library output. You can switch Runtime Library to /MD or /MDd. An other option is recompile boost with static library output and you'll get 'libboost_filesystem-vc100-mt-s-1_49.lib'..

    0 讨论(0)
  • 2020-12-12 23:01

    run below command to rebuild boost in static in VS2013 x86 Native Tools Command Prompt.

    b2 -link=static
    

    Add your linker library paths in your project link path in VS. Then, rebuild your project, error gone.

    0 讨论(0)
  • 2020-12-12 23:08

    The boost libraries that you have in your boost\stage\lib directory are linking dynamically to the standard C++ libraries. See the following post:

    boost lib build configuraton variations

    Your code is linking statically to the standard C++ libraries, hence a mismatch. Try linking your code dynamically to the standard libraries. (Project Settings->General->Configuration Type)

    0 讨论(0)
  • 2020-12-12 23:10

    I had a similar problem with a recent project (inherited from a long legacy).

    Here is a "poor man's" solution to this issue:

    Rebuild the boost libraries with all variants, to be sure that you have the correct variant for your needs.

    Run:

    .\b2 --build-type=complete
    

    Note that the boost build time will obviously be longer with this option.

    This is not an elegant solution, but I didn't have time to mess about figuring out which exact option I needed for my project, so I just built them all.

    0 讨论(0)
提交回复
热议问题