
Phelps Williams wrote:
I am a first time boost user and I am interested in playing with some of the regex features. I am forced to compile boost from svn because I'm using ms visual c++ 9.0. I looked into this process and it appears that no modifications are necessary for a successful compilation.
With bjam.exe in the boost root directory I execute the following command to compile:
bjam.exe -toolset=msvc debug stage
The compilation completes without any errors and all expected lib and dlls are present in $BOOST_ROOT\stage\lib as expected. I then setup a simple regex project to test things out:
#include "stdafx.h" #include
#include <iostream> #include <string> 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; } }
Additionally, I have configured my boost root directory as an Additional Include Directory under Properties -> C/C++ -> General I have also configured my compiled libraries under (Properties -> Linker -> General) Additional Library Directories to the location where the compiled libs were placed. $BOOST_ROOT\stage\lib
During compilation of this project I receive link errors: LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1 _35.lib'
So, it's trying to link to a static library.
The confusing part is in the stage\lib directory all the libs are titled in the following format "boost_libname_vc90-mt-gd.lib" or ".dll" For some reason the libraries are missing the *lib* in front of the name...for example "libboost_regex-vc90-mt-gd-1_35.lib"
Those are dynamic link libraries and import libraries corresponding to them.
I tried to rename this boost_regex example to libboost_regex but I ran into runtime exceptions. Specifically that "boost_regex-vc90-mt-gd-1_35.dll" was not found.
Right, because you are linking to import library, not a static library.
I then copied this dll into the Debug folder where the compiled exe is being executed from and everything executed properly.
Why are the static libraries not named properly? Thanks
I think you should define BOOST_ALL_DYN_LINK when building you application, to inform autolink to use dynamic libraries. - Volodya