1

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.

Erfan
  • 349
  • 1
  • 3
  • 15
  • not the same problem as this ? http://stackoverflow.com/questions/13042561/fatal-error-lnk1104-cannot-open-file-libboost-system-vc110-mt-gd-1-51-lib – 75inchpianist Feb 06 '13 at 15:33
  • Have you built boost libraries? – Igor R. Feb 06 '13 at 16:06
  • @IgorR. No I have installed the libraries via the installer from BoostPro – Erfan Feb 06 '13 at 20:30
  • @Erfan Well, then you have to see how regex debug lib is named in this installation - perhaps its naming have some other layout. But the most simple solution is build boost on your own and have appropriate names, it's quite trivial. – Igor R. Feb 07 '13 at 07:10
  • @75inchpianist it's kind of different. since I used the boost installer it did not contain the stage folder. Also I checked the lib files on sourceforge and it didn't have that either. But after building it myself I got all the lib files needed. – Erfan Feb 15 '13 at 20:17
  • @IgorR. I built it and it worked. Thanks. – Erfan Feb 15 '13 at 20:17

1 Answers1

2

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

SChepurin
  • 1,814
  • 25
  • 17