[英]Linkage problem with Dev c++ and Boost::regex
I'm having a problem using the Boost library in Dev C++, specifically the regex one. 我在Dev C ++中使用Boost库时遇到了问题,特别是正则表达式。 I've tried using their example code:
我尝试使用他们的示例代码:
#include string #include iostream using namespace boost; regex expression("([0-9]+)(\\-| |$)(.*)"); // process_ftp: // on success returns the ftp response code, and fills // msg with the ftp response message. int process_ftp(const char* response, std::string* msg) { cmatch what; if(regex_match(response, what, expression)) { // what[0] contains the whole string // what[1] contains the response code // what[2] contains the separator character // what[3] contains the text message. if(msg) msg->assign(what[3].first, what[3].second); return std::atoi(what[1].first); } // failure did not match if(msg) msg->erase(); return -1; }
The error it's throwing me is: 它抛出的错误是:
[Linker error] undefined reference to `boost::re_detail::get_mem_block()'
[链接器错误]未定义对`boost :: re_detail :: get_mem_block()'的引用
Along with many others linker errors. 以及许多其他链接器错误。 I can't seem to find the way to fix it, even when searching for this problem I've come across other compilers.
我似乎找不到解决此问题的方法,即使在搜索此问题时,我也遇到了其他编译器。 I've already added the include paths to the project for the other header files.
我已经为其他头文件添加了包含路径到项目中。
How I'm supposed to get around it? 我应该如何解决呢? And if I have to change something on the way DevC++ compiles is from the Files tab or the Parameters one?
如果我必须从“文件”选项卡或“参数”选项卡更改DevC ++编译方式的某些内容? And also, on not a way-too-diferent side note, can someone recommend me a good guide or page about Compilers and/or something that could help me?
而且,在没有太多差异的情况下,有人可以向我推荐关于编译器和/或可能对我有所帮助的良好指南或页面吗? (since I couldn't find much in the c++ page).
(因为我在c ++页面中找不到很多东西)。
Thanks. 谢谢。
As far as I know you should build the boost regex library and link to it. 据我所知,您应该构建boost regex库并链接到它。 I assume you are not linking against the regex library.
我假设您没有链接到正则表达式库。
You can find instructions on building the library here: http://www.boost.org/doc/libs/1_45_0/libs/regex/doc/html/boost_regex/install.html 您可以在此处找到有关构建库的说明: http : //www.boost.org/doc/libs/1_45_0/libs/regex/doc/html/boost_regex/install.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.