Erfan
Erfan

Reputation: 349

Boost Link Error

I have installed the boost library and I have Linked both lib and include directories to my solution. As well as setting to Not Using Precompiled Headers. But when I test the simple provided example, I get the Link error when it builds.

#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;
    }
}

Error 1 error LNK1104: cannot open file 'libboost_regex-vc110-mt-gd-1_51.lib'

I have searched the lib folder and this lib file does not exist. I downloaded and installed again and it is not there. It looks like it has been emitted in this version of boost.

Btw, I have installed all the varients of regex and I am using the VS12.

UPDATE: If anyone else has the same problem try NOT to use boost installer and build it yourself.

Upvotes: 1

Views: 901

Answers (1)

SChepurin
SChepurin

Reputation: 1854

Some of the Boost libraries have to be built -

The only Boost libraries that must be built separately are: ... Boost.Regex

(from Header-Only Libraries)

The easy (but not recommended) way is to download required binary from Internet. For example - boostlib - Revision 9: /trunk/stage/lib. Then add it in Linker -> General -> Additional Library Directories

Upvotes: 2

Related Questions