【发布时间】:2013-01-21 20:45:22
【问题描述】:
我已经安装了 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 安装程序并自己构建它。
【问题讨论】:
-
不是同一个问题吗? stackoverflow.com/questions/13042561/…
-
你建过boost库吗?
-
@IgorR。不,我已经通过 BoostPro 的安装程序安装了库
-
@Erfan 好吧,那么你必须看看在这个安装中 regex 调试库是如何命名的——也许它的命名有一些其他的布局。但最简单的解决方案是自己构建 boost 并具有适当的名称,这很简单。
-
@75inchpianist 有点不同。因为我使用了 boost 安装程序,所以它不包含 stage 文件夹。我还检查了 sourceforge 上的 lib 文件,它也没有。但是在我自己构建之后,我得到了所有需要的 lib 文件。