C ++ - std :: set is not declared

#include <iostream>

 using std::set;
 using std::cout;
 using std::endl;

The error is reported:

Josephus_Permutation.cpp:3:13: error: โ€˜std::setโ€™ has not been declared

Shouldn't there std::setbe an STL namespace std?

+5
source share
1 answer

It is in the namespace std, but you need to include the appropriate header:

#include <set>

The header <iostream>contains only the standard I / O library, which includes std::coutand std::endl. std::set, however, is defined in <set>.

+17
source

All Articles