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 3240280
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:04:02+00:00 2026-05-17T18:04:02+00:00

I am using g++ in Ubuntu g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 I have this code

  • 0

I am using g++ in Ubuntu

g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3

I have this code

#include<unordered_map>
using namespace std;

bool ifunique(char *s){
  unordered_map<char,bool> h;
  if(s== NULL){
    return true;
  }
  while(*s){
    if(h.find(*s) != h.end()){
      return false;
    }
    h.insert(*s,true);
    s++;
  }
  return false;
}

when I compile using

g++ mycode.cc

I got error

 error: 'unordered_map' was not declared in this scope

Am I missing something?

  • 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-17T18:04:03+00:00Added an answer on May 17, 2026 at 6:04 pm

    In GCC 4.4.x, you should only have to #include <unordered_map>, and compile with this line:

    g++ -std=c++0x source.cxx

    More information about C++0x support in GCC.

    edit regarding your problem

    You have to do std::make_pair<char, bool>(*s, true) when inserting.

    Also, your code would only insert a single character (the dereferencing via *s). Do you intend to use a single char for a key, or did you mean to store strings?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When i try to compile the following code: #include <string.h> using namespace std; typedef
Im using Ubuntu 10.10, Code::Blocks with GCC 4.2. I have written a code like
#include<iostream> using namespace std; int main() { int hash, opp, i, j, c =
I am using ubuntu 12.04 on 64 bit machine, I have this simple C
I am using Ubuntu 9.04 I have installed the following package versions: unixodbc and
I am using Ubuntu 9.10 For a particular piece of code I require GCC
I am using ubuntu in my server. I have two users, let them be
I have installed the vim-latex package using Ubuntu Synaptic package manager and updated my
I have a mystery here: I'm using Ubuntu SCons (package version 1.2.0.d20100117-1). I have
I am using ubuntu and I have some html pages. I want to host

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.