我已经安装了 boost 库,并且我已经将 lib 和 include 目录链接到我的解决方案。以及设置为Not Using Precompiled Headers。但是当我测试提供的简单示例时,我在构建时收到了 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文件不存在。我再次下载并安装,它不存在。看起来它已经在这个版本的 boost 中发出了。
顺便说一句,我已经安装了所有的正则表达式,我正在使用 VS12。
更新:如果其他人有同样的问题,尽量不要使用 boost 安装程序并自己构建它。