Menu

#55 Build failure: "error: use of undeclared identifier 'erase'" in cccc_tbl.cc

Other
open
nobody
None
5
2015-09-19
2015-09-19
kbinani
No

I have found build error on Mac OS X.

The error messages are:

./cccc_tbl.cc:99:7: error: use of undeclared identifier 'erase'
      erase(value_iterator);
      ^
      this->
cccc_prj.cc:229:17: note: in instantiation of member function 'CCCC_Table<CCCC_UseRelationship>::remove' requested here
          userel_table.remove(userel_ptr);
                       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1074:14: note: must qualify identifier to find this declaration in dependent base class
    iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1076:15: note: must qualify identifier to find this declaration in dependent base class
    size_type erase(const key_type& __k)
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1079:15: note: must qualify identifier to find this declaration in dependent base class
    iterator  erase(const_iterator __f, const_iterator __l)
              ^
1 error generated.

To fix this error, call "erase" with "map_t" prefix like this:

--- a/cccc/cccc_tbl.cc
+++ b/cccc/cccc_tbl.cc
@@ -96,7 +96,7 @@ bool CCCC_Table<T>::remove(T* old_item_ptr)
   typename map_t::iterator value_iterator=map_t::find(old_item_ptr->key());
   if(value_iterator!=map_t::end())
     {

-      erase(value_iterator);
+      map_t::erase(value_iterator);
       retval=true;
     }
   return retval;

Discussion


Log in to post a comment.

MongoDB Logo MongoDB