1

I am not able to compile the below code at eclipse.Can anyone let me know what can be reason although stl library is included for the same.

#include<iostream>
#include <unordered_set>
using namespace std;

int main()
{
string str;
unordered_set <string> s;// symbol unordered_set can't be resolved
while(getline(cin,str)) // 
    {
    if(str=="exit")
            {
              break;
            }
    s.insert(str);
    }

return 1;
}
user2997518
  • 812
  • 6
  • 17
  • 2
    The [`std::unordered_set`](http://en.cppreference.com/w/cpp/container/unordered_set) class is part of C++11, have you enabled it for your compiler? I don't know if Eclipse have a special toggle for this, otherwise you have to add the flag `-std=c++11` (or if your compiler is a little old `-std=c++1x`, and if your compiler is much to old you can't use it at all). – Some programmer dude Nov 18 '13 at 14:50
  • Yes , I have enabled it for my compiler and eclipse is not giving any error while including this class, but not sure why it is giving while creating object of this class. – user2997518 Nov 18 '13 at 15:05
  • you don't have `#include `; is string included anywhere? – user1167662 Nov 18 '13 at 15:29
  • Oh, I believe these are the bogus errors from Codan, see [Turn off eclipse errors (that arent really errors)](http://stackoverflow.com/q/14131939/341970) for a workaround. – Ali Nov 18 '13 at 15:40
  • i don't require to add the string class , it works without this. – user2997518 Nov 18 '13 at 17:14

0 Answers0