我已经安装了boost库,并且已经将lib和include目录链接到我的解决方案。以及设置为不使用预编译头。但是,当我测试所提供的简单示例时,当它构建时,我会得到Link错误。
#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;
}
}
错误1错误LNK1104:无法打开文件'libboost_regex-vc110-mt-gd-1_51.lib'
我已经搜索了lib文件夹,但这个lib文件不存在。我再次下载并安装了它,但它不在那里。它看起来像是在这个版本的助推中发射的。
顺便说一句,我已经安装了regex的所有变体,我正在使用VS12。
更新:如果其他人也有同样的问题,请尝试NOT使用boost安装程序并自己构建。
必须构建一些Boost库-
必须单独构建的Boost库只有:。。。促进Regex
(来自仅标题库)
简单(但不推荐)的方法是从互联网下载所需的二进制文件。例如-boostlib-修订版9:/trunk/stage/lib。然后将其添加到Linker->General->Additional Library Directories