Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

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

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_filesystem-vc100-mt-s-1_49.lib'

However, in the booststagelib directory I only have the next libraries referred to filesystem module:

libboost_filesystem-vc100-mt-1_49.lib

libboost_filesystem-vc100-mt-gd-1_49.lib

My questions are:

Why does the VC++ is asking for 'libboost_filesystem-vc100-mt-s-1_49.lib?

Which compiler/linking properties should I change to get the compiler to ask for libboost_filesystem-vc100-mt-1_49.lib?

UPDATE: My VC2010++ solution has 2 projects that include the previous boost library: x is a library and y (the main program) which invokes to x.

  1. When I build x with Configuration type=Static library and RuntimeLibrary=Multi-threaded (/MT), it is ok.
  2. When I build y with Configuration type=Application (.exe) and RuntimeLibrary=Multi-threaded (/MT), it issues the error I indicated, if I change to Configuration type=Static library it builds ok, but my main program has .lib extension and not the expected .exe.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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'..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...