i have an interest in boost/regex library - i need to extract url from a file ----> bookmark.html (from ie6)

the regex demo programs use this library - but it is from 2003.

when i try to run the program - i get an error:

LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc80-mt-gd-1_34_1.lib'

i use vc++2005(studio) on win/xp(v2)

the problem is well known but when i try this links i find no help:


what do i have to do (step by step) to build the regex boost library - so vc2005(studio) can
"work" with the library?

Recommended Answers

All 4 Replies

Didn't you read the links properly?

6.1 Link From Within the Visual Studio IDE

Starting with the header-only example project we created earlier:

1. Right-click example in the Solution Explorer pane and select Properties from the resulting pop-up menu
2. In Configuration Properties > Linker > Additional Library Directories, enter the path to the Boost binaries, e.g. C:\Program Files\boost\boost_1_34_1\lib\.
3. From the Build menu, select Build Solution.

i took this short program as a demo:

#include <boost/regex.hpp>
#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;

from url: http://www.boost.org/more/getting_started/windows.html
(6   Link Your Program to a Boost Library)

and the result is:

------ Build started: Project: example, Configuration: Debug Win32 ------
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc80-mt-gd-1_34_1.lib'
Build log was saved at "file://c:\schmidt23_cpp\example\example\Debug\BuildLog.htm"
example - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

the VC2005 IS RIGHT i searched this library and it's missing !

Not every possible flavor necessarily compiles using the default build process.

You are trying to link with the regex library that has the following features:
- multithreading support
- using debug versions of the standard and runtime support libraries

If your application doesn't use multithreading, you don't need the -mt- tag in the library name: remove it and use a smaller lib.

Also, there is really no reason you need to link to debug versions of the standard and runtime libraries. That stuff is for people developing the standard and runtime libraries. Otherwise, you can safely assume that the standard and runtime libraries won't cause any errors... Get rid of the -gd- tag. (If you are debugging your own code, you may want to leave the -d- tag in there until you compile the release version of your program.)

Most of the tags you will not need unless you are doing something pretty unusual. The most likely is the -s- tag if you want to statically link with the standard and runtime libraries on *nix systems. (Static linkage is default on Windows.)

Hope this helps.

THIS IS A LONG SOLUTION - 2 WEEKS WORK But long road is sometime the short...
( solution for vc++ 2005(studio) boost/regex 1.3.41 )

download: boost_1_34_1_setup.exe

and let it do what it does.

after: move to: ----> C:\Program Files\boost\boost_1_34_1\libs\regex\build

copy file vc8.mak ----> vc81.mak

inside vc81.mak change string: "-1_34" to: "-1_34_1"

and NOW:

nmake -fvc81.mak

at this point you can see that at sub-dir /vc80 ---> files + libraries are created.

at end:

copy the: libboost_regex-vc80-mt-gd-1_34_1 (extension object file library)
C:\Program Files\boost\boost_1_34_1\lib

NOW: move to vc++2005(studio)

at the properties of the project:

Properties ---> Linker ---> Additional Library Directories

"c:\Program Files\boost\boost_1_34_1\lib"

and that's all !!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.