我試圖在我的程序中使用boost正則表達式 問題是我得到這個錯誤... 唯一的安裝步驟我所做的就是補充: 「C:\ Program Files文件\提升\ boost_1_42」 進入附加包含目錄...致命錯誤LNK1104:無法打開文件'libboost_regex-vc90-mt-gd-1_42.lib'
我使用VS2008 ...
想實現這一點:
#include <iostream>
#include <string>
#include <boost/regex.hpp>
using namespace std;
int main() {
std::string s, sre;
boost::regex re;
boost::cmatch matches;
while(true)
{
cout << "Expression: ";
cin >> sre;
if (sre == "quit")
{
break;
}
cout << "String: ";
cin >> s;
try
{
// Assignment and construction initialize the FSM used
// for regexp parsing
re = sre;
}
catch (boost::regex_error& e)
{
cout << sre << " is not a valid regular expression: \""
<< e.what() << "\"" << endl;
continue;
}
// if (boost::regex_match(s.begin(), s.end(), re))
if (boost::regex_match(s.c_str(), matches, re))
{
// matches[0] contains the original string. matches[n]
// contains a sub_match object for each matching
// subexpression
for (int i = 1; i < matches.size(); i++)
{
// sub_match::first and sub_match::second are iterators that
// refer to the first and one past the last chars of the
// matching subexpression
string match(matches[i].first, matches[i].second);
cout << "\tmatches[" << i << "] = " << match << endl;
}
}
else
{
cout << "The regexp \"" << re << "\" does not match \"" << s << "\"" << endl;
}
}
}
什麼似乎是問題?應該做什麼額外的設置?
還是同樣的錯誤...... 1> LINK:致命錯誤LNK1104:無法打開文件 'libboost_regex-VC90-MT-GD-1_42.lib' 確實做到了爲u說... – kaycee
確定它的工作原理.. 。添加到鏈接器「C:\ Program Files \ boost \ boost_1_42 \ stage \ lib \ libboost_regex-vc90-mt-gd-1_42.lib」 – kaycee
'_HAS_ITERATOR_DEBUGGING'僅適用於Debug版本。不過,關於'_SECURE_SCL',您是否遇到過混合啓用庫的庫和禁用庫的問題? –