0
喜正試圖在boost庫編譯一個簡單的程序,但我一直得到了鏈接錯誤升壓鏈接錯誤-regular表情 - C++
#include <iostream>
#include <string>
#include <boost\regex.hpp> // Boost.Regex lib
using namespace std;
int main() {
std::string s, sre;
boost::regex re;
while(true)
{
cout << "Expression: ";
cin >> sre;
if (sre == "quit")
{
break;
}
cout << "String: ";
cin >> s;
try
{
// Set up the regular expression for case-insensitivity
re.assign(sre, boost::regex_constants::icase);
}
catch (boost::regex_error& e)
{
cout << sre << " is not a valid regular expression: \""
<< e.what() << "\"" << endl;
continue;
}
if (boost::regex_match(s, re))
{
cout << re << " matches " << s << endl;
}
}
}
,但我一直得到了鏈接錯誤
[Linker error] undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
哪有我解決這個問題?
PS:我使用DEVCPP IDE我從安裝升壓www.devpaks.org
使用Visual Studio,您有自動鏈接支持,但gcc不支持它。 – 2009-11-21 06:23:13
@gf:感謝您的單挑;我不知道。 – 2009-11-21 06:28:28