mercredi 3 janvier 2018

Unable to compile c++ program on Ubuntu

I am unable to compile the following program. I am using g++ version 5 on ubuntu.

#include<iostream>
#include<iterator>
int main()
{
    iterator it;
    return 0;
}

It gives me the following errors,

a.cc: In function ‘int main()’:
a.cc:5:5: error: ‘iterator’ was not declared in this scope
     iterator it;
     ^
a.cc:5:5: note: suggested alternatives:
In file included from /usr/include/c++/5/bits/stl_algobase.h:65:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from a.cc:1:
/usr/include/c++/5/bits/stl_iterator_base_types.h:118:12: note:   ‘std::iterator’
     struct iterator
            ^
/usr/include/c++/5/bits/stl_iterator_base_types.h:118:12: note:   ‘std::iterator’

Aucun commentaire:

Enregistrer un commentaire