c++ - linker error when using tr1::regex -


I have a program that uses tr1 :: regex , and compile it At the time, it gives me lots of lucrative errors.

Here my header file is MapObject.hpp:

  #include  

This is my implementation:

  #include & lt; Iostream & gt; #include & lt; String & gt; # Include & lt; Tr1 / regex & gt; # Include "MapObject.hpp" using the name std; Namespace phObject {const tr1 :: regex map object :: colorRX ("# [a-fA-F0- 9] {6}"); Zero MapObject :: setColor (const string & amp; c) {if (tr1 :: regex_match (c.begin (), c.end (), colorRX)} {color = c; } And Serre Lieutenant; & Lt; "Invalid color assignment (" <"   & Lt; Endl; } (...)}  

and for errors now:

maximum @ max-desktop: ~ / desktop / development / CPPTH / party hack / Lib $ g ++ -Wall -std = c ++ 0x MapObject.cpp
/tmp/cce5gojG.o: In the function std :: tr1 :: basic_regex & lt; Char, std :: tr1 :: regex_traits & lt; Char & gt; & Gt; :: Basic_regax (four conson *, unsigned integer): Map object CPP :(. Text._ZNSt3tr111basic_regexIcNS_12regex_traitsIcEEEC1EPKcj [std :: tr1 :: basic_regex & lt; char, std :: tr1 :: regex_traits & lt; variable & gt; :: Basic_regags (thor const *, unsigned integer)] + 0x61): std :: tr1 :: basic_regex> :: Undefined context for M_compile (): / / FTP / cce5goj.Goo: in the function Bool std :: tr1 :: regex_match & lt; __ gnu_cxx :: ___ normal_iterator & lt; Four constant *, std :: basic_string & lt; Four, std :: char_traits & lt; Four>, std :: defluent & lt; Four & gt; & Gt; & Gt ;, char, std :: tr1 :: regex_traits & lt; Char & gt; & Gt; (__ gnu_cxx :: __ normal_iterator & lt; four constant *, std :: basic_string & lt; four; std :: char_traits & lt; four & gt; std :: communicator & lt; four & gt; & gt; Gt;, __gnu_cxx :: ___ normal_iterator & lt; four constant *, std:: basic_string & lt; four; std :: char_traits & lt; four & gt; std :: communicator & lt; four & gt; & gt; & Gt; std :: tr1 :: basic_regex & lt; four; std :: tr1 :: regex_traits & lt; four & gt; constants & std :: bitset & lt; 11u & gt; ': MapObject.cpp
:( text._ZNSt3tr111regex_matchIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcEEEEbT_S8_RKNS_11basic_regexIT0_T1_EESt6bitsetILj11EE [bool std :: tr1 :: regex_match & LT; __ gnu_cxx :: __ normal_iterator & LT; four constants *, std :: basic_string & LT; char, std .: : Char_traits & lt; four & gt; std :: The predictor is <4> gt; & gt; four; std :: tr1 :: regex_traits & lt; four & gt; & gt; (__ gnu_cxx :: __ normal_iterator & lt; four constant *, std: : Basic_string & lt; four; std :: char_traits & lt; Char & gt ;, std :: allocation & lt; Char & gt; & Gt; & Gt ;, __gnu_cxx :: __easy_quitator & lt; Char const *, std :: basic_string & lt; Char, std :: char_traits & lt; Char & gt ;, std :: allocator & lt; Char & gt; & Gt; & Gt; std :: tr1 :: basic_regex & lt; Char, std :: tr1 :: regex_traits & lt; Variables & gt; & Gt; Constant & amp;; std :: bitset & lt; 11u & gt;]] 0x53):
bool std :: tr1 :: regex_match & lt undefined reference; __ gnu_cxx :: ___ normal_iterator, std :: defender >>, std :: defluent, std :: deflector >>>>, four, std :: tr1 :: regex_traits> (__ gnu_cxx :: ___ normal_iterator, std :: defiant >>, __gnu_cxx :: __ normal_iterator, std :: declinator >>, std :: tr1 :: match_results do & lt; __ gnu_cxx :: __ normal_iterator, std :: allocator >>, std :: allocator, std :: allocator >>>>> & std :: tr1 :: basic_regex> const & amp;; std :: bitset & lt; 11u>)

Archive 2: LD returns 1 exit status

I can not actually head or tail to leaving the undefined reference for the code to anyone near the beginning Do you know what is happening? Regex support for C ++ 0x is incomplete and there was no TR1, C ++ 0x /

Boost offers an option, as well as it is based on it.


Comments