【发布时间】:2015-03-13 18:51:57
【问题描述】:
我在 Ubuntu 上使用正则表达式时遇到了问题,在 Qt 平台上(我也在 Code::Blocks 上尝试过)。我正在编写控制台应用程序代码,我必须使用正则表达式。
当我输入#include <regex>时,对我来说是那个错误(我认为这是最重要的错误,但是正则表达式的错误很多):
/usr/include/c++/4.9/bits/c++0x_warning.h:32: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
我认为我应该使用 Boost 库。我安装了 Boost:
sudo apt-get install libboost-all-dev
然后打字(我编辑了一些东西,开头写了boost::):
#include <boost/regex.hpp>
但是,不幸的是,它引起了很多错误,比如:
In function `bool boost::regex_search<__gnu_cxx::__normal_iterator<char const*, std::string>, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)':
我真的很困惑我该怎么做。
【问题讨论】: