我正在尝试regex
在 Dev-C++ (tdm-gcc 4.7.1) 中使用。
我已经从 boost.org 下载了 Boost 库并解压到
C:\Program Files (x86)\Dev-Cpp\boost
并在 Dev-C++ 中添加
C:\Program Files (x86)\Dev-Cpp\boost\libs
到图书馆。
包含路径(C/C++):
C:\Program Files (x86)\Dev-Cpp\boost
main.cpp
:
#include <boost/regex.hpp>
using namespace boost;
int main()
{
string s ("some txt PING :665454 some_text");
smatch mt;
regex r ("PING :(\\d+) "); // error
system( "pause" );
return 0;
}
错误:
D:\programowanie\dev-c++\main12\main.o main.cpp:(.text$_ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE[_ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE]+0xc3): undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'
D:\programowanie\dev-c++\main12\main.o main.cpp:(.text$_ZN5boost9re_detail11raw_storage6extendEy[_ZN5boost9re_detail11raw_storage6extendEy]+0x60): undefined reference to `boost::re_detail::raw_storage::resize(unsigned long long)'
c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe main12/main.o: bad reloc address 0x60 in section `.text$_ZN5boost9re_detail11raw_storage6extendEy[_ZN5boost9re_detail11raw_storage6extendEy]'
c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe final link failed: Invalid operation
D:\programowanie\dev-c++\collect2.exe [Error] ld returned 1 exit status