Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7556265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:49:24+00:00 2026-05-30T11:49:24+00:00

I have the following code: #include <string> #include <iostream> #include <tr1/unordered_map> typedef std::tr1::unordered_map<unsigned long

  • 0

I have the following code:

#include <string>
#include <iostream>

#include <tr1/unordered_map>

typedef std::tr1::unordered_map<unsigned long int,std::string> eoh_map;

...
int main() {
    eoh_map m;

    bool found = m.find(10) != m.end();
}
...

And the following error:

In file included from src/DeDuplicator_addon.cpp:29:0:
/usr/include/c++/4.5/tr1/unordered_map.h:37:19: error: expected type-specifier before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:37:19: error: expected ‘>’ before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:42:24: error: expected template-name before ‘<’ token
/usr/include/c++/4.5/tr1/unordered_map.h:42:24: error: expected ‘{’ before ‘<’ token
/usr/include/c++/4.5/tr1/unordered_map.h:42:24: error: expected unqualified-id before ‘<’ token
/usr/include/c++/4.5/tr1/unordered_map.h:86:19: error: expected type-specifier before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:86:19: error: expected ‘>’ before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:91:24: error: expected template-name before ‘<’ token
/usr/include/c++/4.5/tr1/unordered_map.h:91:24: error: expected ‘{’ before ‘<’ token
/usr/include/c++/4.5/tr1/unordered_map.h:91:24: error: expected unqualified-id before ‘<’ token
/usr/include/c++/4.5/tr1/unordered_map.h:141:28: error: wrong number of template arguments (6, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:41:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_map’
/usr/include/c++/4.5/tr1/unordered_map.h:143:28: error: wrong number of template arguments (6, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:41:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_map’
/usr/include/c++/4.5/tr1/unordered_map.h: In function ‘void std::tr1::swap(int&, int&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:144:11: error: request for member ‘swap’ in ‘__x’, which is of non-class type ‘int’
/usr/include/c++/4.5/tr1/unordered_map.h: At global scope:
/usr/include/c++/4.5/tr1/unordered_map.h:150:28: error: wrong number of template arguments (6, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:90:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_multimap’
/usr/include/c++/4.5/tr1/unordered_map.h:152:28: error: wrong number of template arguments (6, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:90:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_multimap’
/usr/include/c++/4.5/tr1/unordered_map.h:152:34: error: redefinition of ‘template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, bool __cache_hash_code> void std::tr1::swap(int&, int&)’
/usr/include/c++/4.5/tr1/unordered_map.h:143:34: error: ‘template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, bool __cache_hash_code> void std::tr1::swap(int&, int&)’ previously declared here
/usr/include/c++/4.5/tr1/unordered_map.h: In function ‘void std::tr1::swap(int&, int&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:153:11: error: request for member ‘swap’ in ‘__x’, which is of non-class type ‘int’
/usr/include/c++/4.5/tr1/unordered_map.h: At global scope:
/usr/include/c++/4.5/tr1/unordered_map.h:175:19: error: expected type-specifier before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:175:19: error: expected ‘>’ before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:179:48: error: ‘_Pred’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:179:55: error: ‘_Alloc’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:179:61: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:41:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_map’
/usr/include/c++/4.5/tr1/unordered_map.h:181:49: error: ‘_Pred’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:181:56: error: ‘_Alloc’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:181:62: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:41:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_map’
/usr/include/c++/4.5/tr1/unordered_map.h:184:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:185:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:186:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:187:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:188:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h: In constructor ‘std::tr1::unordered_map<_Key, _Tp, _Hash>::unordered_map(std::tr1::unordered_map::size_type, const std::tr1::unordered_map::hasher&, const std::tr1::unordered_map::key_equal&, const std::tr1::unordered_map::allocator_type&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:195:9: error: ‘typedef int std::tr1::unordered_map<_Key, _Tp, _Hash>::_Base’ is not a non-static data member of ‘std::tr1::unordered_map<_Key, _Tp, _Hash>’
/usr/include/c++/4.5/tr1/unordered_map.h: In constructor ‘std::tr1::unordered_map<_Key, _Tp, _Hash>::unordered_map(_InputIterator, _InputIterator, std::tr1::unordered_map::size_type, const std::tr1::unordered_map::hasher&, const std::tr1::unordered_map::key_equal&, const std::tr1::unordered_map::allocator_type&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:204:4: error: ‘typedef int std::tr1::unordered_map<_Key, _Tp, _Hash>::_Base’ is not a non-static data member of ‘std::tr1::unordered_map<_Key, _Tp, _Hash>’
/usr/include/c++/4.5/tr1/unordered_map.h: At global scope:
/usr/include/c++/4.5/tr1/unordered_map.h:227:19: error: expected type-specifier before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:227:19: error: expected ‘>’ before ‘hash’
/usr/include/c++/4.5/tr1/unordered_map.h:231:53: error: ‘_Pred’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:231:60: error: ‘_Alloc’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:231:66: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:90:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_multimap’
/usr/include/c++/4.5/tr1/unordered_map.h:233:54: error: ‘_Pred’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:233:61: error: ‘_Alloc’ was not declared in this scope
/usr/include/c++/4.5/tr1/unordered_map.h:233:67: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:90:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::__unordered_multimap’
/usr/include/c++/4.5/tr1/unordered_map.h:236:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:237:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:238:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:239:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:240:24: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h:253:16: error: ‘_Base’ is not a class or namespace
/usr/include/c++/4.5/tr1/unordered_map.h: In constructor ‘std::tr1::unordered_multimap<_Key, _Tp, _Hash>::unordered_multimap(std::tr1::unordered_multimap::size_type, const std::tr1::unordered_multimap::hasher&, const std::tr1::unordered_multimap::key_equal&, const std::tr1::unordered_multimap::allocator_type&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:247:9: error: ‘typedef int std::tr1::unordered_multimap<_Key, _Tp, _Hash>::_Base’ is not a non-static data member of ‘std::tr1::unordered_multimap<_Key, _Tp, _Hash>’
/usr/include/c++/4.5/tr1/unordered_map.h: In constructor ‘std::tr1::unordered_multimap<_Key, _Tp, _Hash>::unordered_multimap(_InputIterator, _InputIterator, int, const std::tr1::unordered_multimap::hasher&, const std::tr1::unordered_multimap::key_equal&, const std::tr1::unordered_multimap::allocator_type&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:257:4: error: ‘typedef int std::tr1::unordered_multimap<_Key, _Tp, _Hash>::_Base’ is not a non-static data member of ‘std::tr1::unordered_multimap<_Key, _Tp, _Hash>’
/usr/include/c++/4.5/tr1/unordered_map.h: At global scope:
/usr/include/c++/4.5/tr1/unordered_map.h:264:55: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:178:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::unordered_map’
/usr/include/c++/4.5/tr1/unordered_map.h:265:48: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:178:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::unordered_map’
/usr/include/c++/4.5/tr1/unordered_map.h: In function ‘void std::tr1::swap(int&, int&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:266:11: error: request for member ‘swap’ in ‘__x’, which is of non-class type ‘int’
/usr/include/c++/4.5/tr1/unordered_map.h: At global scope:
/usr/include/c++/4.5/tr1/unordered_map.h:270:60: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:230:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::unordered_multimap’
/usr/include/c++/4.5/tr1/unordered_map.h:271:53: error: wrong number of template arguments (5, should be 3)
/usr/include/c++/4.5/tr1/unordered_map.h:230:11: error: provided for ‘template<class _Key, class _Tp, class _Hash> class std::tr1::unordered_multimap’
/usr/include/c++/4.5/tr1/unordered_map.h:271:59: error: redefinition of ‘template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> void std::tr1::swap(int&, int&)’
/usr/include/c++/4.5/tr1/unordered_map.h:265:54: error: ‘template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> void std::tr1::swap(int&, int&)’ previously declared here
/usr/include/c++/4.5/tr1/unordered_map.h: In function ‘void std::tr1::swap(int&, int&)’:
/usr/include/c++/4.5/tr1/unordered_map.h:272:11: error: request for member ‘swap’ in ‘__x’, which is of non-class type ‘int’
src/DeDuplicator_addon.cpp: At global scope:
src/DeDuplicator_addon.cpp:48:57: error: template argument 3 is invalid
src/DeDuplicator_addon.cpp:48:66: error: invalid type in declaration before ‘;’ token

I’m using g++ 4.5.2 on Ubuntu.

Can someone help with this error?

Many thanks in advance,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:49:26+00:00Added an answer on May 30, 2026 at 11:49 am

    std::tr1::unordered_map<…>::find() returns an iterator and not a bool. If you want to check if the entry was found, do:

    bool found = m.find(10) != m.end();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code #include <iostream> #include <string> #include <algorithm> using namespace std; int
i have following code #include <iostream> using namespace std; int main(){ int i; char
I have the following code: #include <iostream> #include <string> #include sqlite3.h int main() {
I have the following code: #include <iostream> #include <string> void main() { std::string str;
I have the following c++ code: #include <iostream> #include <string> int main( int argc,
I have the following code: #include <string.h> int main(void) { char *buffer = NULL,
I have the following code #include <iostream> #include<string> #include <sstream> using namespace std; struct
i have following code in c++ #include <iostream> using namespace std; void qsort5(int a[],int
i have following code #include <iostream> #include <string> using namespace std; string generate(){ for
i have following code #include <iostream> #include <set> #include <string> using namespace std; template<class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.