0
我之前在我的舊電腦上使用了boost :: regex,但現在我無法弄清楚如何能夠使用它。用boost編譯正則表達式C++
我有鏈接的問題,我越來越:
||=== Build: Release in regex test (compiler: GNU GCC Compiler) ===|
C:\boost\stage\lib\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTSN5boost16exception_detail19error_info_injectorISt13runtime_errorEE[__ZTSN5boost16exception_detail19error_info_injectorISt13runtime_errorEE]' has different size|
C:\boost\stage\lib\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE[__ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE]' has different size|
C:\boost\stage\lib\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTVN5boost16exception_detail19error_info_injectorISt13runtime_errorEE[__ZTVN5boost16exception_detail19error_info_injectorISt13runtime_errorEE]' has different size|
C:\boost\stage\lib\libboost_regex-mgw53-mt-1_63.a(regex.o)||duplicate section `.rdata$_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE[__ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEEE]' has different size|
C:\boost\stage\lib\libboost_regex-mgw53-mt-1_63.a(cpp_regex_traits.o)||duplicate section `.data$_ZZN5boost16cpp_regex_traitsIcE21get_catalog_name_instEvE6s_name[__ZZN5boost16cpp_regex_traitsIcE21get_catalog_name_instEvE6s_name]' has different size|
obj\Release\main.o:main.cpp:(.text$_ZNK5boost16re_detail_10630031cpp_regex_traits_implementationIcE18lookup_collatenameEPKcS4_[__ZNK5boost16re_detail_10630031cpp_regex_traits_implementationIcE18lookup_collatenameEPKcS4_]+0x80)||undefined reference to `boost::re_detail_106300::lookup_default_collate_name(std::string const&)'|
obj\Release\main.o:main.cpp:(.text$_ZN5boost16re_detail_10630018basic_regex_parserIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE4failENS_15regex_constants10error_typeEiSsi[__ZN5boost16re_detail_10630018basic_regex_parserIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE4failENS_15regex_constants10error_typeEiSsi]+0x1d4)||undefined reference to `boost::regex_error::regex_error(std::string const&, boost::regex_constants::error_type, int)'|
||error: ld returned 1 exit status|
||=== Build failed: 3 error(s), 5 warning(s) (0 minute(s), 0 second(s)) ===|
的代碼是這樣的:
#include <boost/regex.hpp>
int main()
{
boost::regex test("test");
return 0;
}
我鏈接C:\boost\stage\lib\libboost_regex-mgw53-mt-1_63.a
,搜索目錄是C:\boost
。
我正在編譯使用代碼塊爲您的信息。
我用mingw/gcc編譯或「製作」了庫文件,實際上我嘗試了很多東西......我也下載並安裝了mingw,即使我已經使用了代碼塊,並且「 「後來我安裝了一個庫。 (mingw的路徑設置爲那裏)。
看起來像衝突的編譯器版本/標誌。 – sehe
@Neox,你可以使用std :: regex代替boost :: regex。它是用C++ 11添加的。 –
@你可以更精確嗎?我認爲問題來自我使用mingw手動下載編譯庫,並用代碼塊的mingw編譯項目。你認爲這是問題嗎? – Neox