C++ - std :: set未声明

CDT*_*CDT 7 c++ debugging

#include <iostream>

 using std::set;
 using std::cout;
 using std::endl;
Run Code Online (Sandbox Code Playgroud)

错误报告:

Josephus_Permutation.cpp:3:13: error: ‘std::set’ has not been declared

std::set应该是命名空间的STL std吗?

Jos*_*eld 19

它位于std命名空间中,但您需要包含适当的标头:

#include <set>
Run Code Online (Sandbox Code Playgroud)

<iostream>标头仅包含标准输入/输出库,其中包括std::coutstd::endl.std::set然而,定义于<set>.

  • 好像我问过一个愚蠢的问题......谢谢. (3认同)