簡體   English   中英

Boost Regex引發錯誤

[英]Boost Regex throwing an error

當我嘗試使用eclipse在g +編譯器中編譯代碼時出現以下錯誤

In function `ZSt19__iterator_categoryIPKSsENSt15iterator_traitsIT_E17iterator_categoryERKS3_':
C:/Program Files (x86)/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:(.text$_ZN5boost11basic_regexIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j[boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned int)]+0x22): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
collect2: ld returned 1 exit status
Build error occurred, build is stopped

我要做的就是這句話

boost :: regex re(“ \\ s +”); 連同標題#inlucde

您能告訴我如何進行嗎?

看來您沒有鏈接到正確的庫。 大多數Boost庫都是僅標頭的,因此您不需要在鏈接時對其進行任何處理。 但是,Boost :: regex是少數要求您與庫鏈接以及為編譯器提供適當頭文件的鏈接之一。

修復此問題之后,您將需要重新檢查字符串中的轉義符-現在您傳遞的“ \\ s”不應該被允許(猜測,您可能希望使用“ \\ s +”)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM