Boost link error when using "--layout=system" on VS2005

boost, c++, linker

Solution

Fast answer, for I have no access to a Visual C++ at home.

I believe you are clashing with the "autolinking" of Boost on Visual C++ compilers.

A solution would be to disable "autolink" (see your documentation for that: A quick google search showed the macro "BOOST_ALL_NO_LIB" to disable autolinking for ALL Boost libraries), and then link explicitely your project to the right library.

I'll update this answer as soon as possible.

Problem

I'm new to boost, and thought I'd try it out with some realistic deployment scenarios for the .dlls, so I used the following command to compile/install the libraries: ``` .\bjam install --layout=system variant=debug runtime-link=shared link=shared --with-date_time --with-thread --with-regex --with-filesystem --includedir=<my include directory> --libdir=<my bin directory> > installlog.txt ``` That seemed to work, but my simple program (taken right from the "Getting Started" page) fails: ``` #include <boost/regex.hpp> #include <iostream> #include <string> // Place your functions after this line int main() { std::string line; boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" ); while (std::cin) { std::getline(std::cin, line); boost::smatch matches; if (boost::regex_match(line, matches, pat)) std::cout << matches[2] << std::endl; } } ``` This fails with the following linker error: ``` fatal error LNK1104: cannot open file 'libboost_regex-vc80-mt-1_42.lib' ``` I'm sure that both the .lib and the .dlls are in that directory, and named how I want them to be (ie: boost_regex.lib, etc, all unversioned, as the --layout=system says). So why is it looking for the versioned type of it? And how do I get it to look for the unversioned type of the library? I've tried this with more "normal" options, such as below: ``` .\bjam stage --build-type=complete --with-date_time --with-thread --with-filesystem --with-regex > mybuildlog.txt ``` And that works fine. I made sure my compiler saw the "stage\lib" directory, and it compiled and ran fine with nothing beyond having the environment looking into the right lib directory. But when I took those "testing" directories away, and wanted to use these others (unversioned), then it failed. I'm under VS2005 here on XP. Any ideas?

Original source