下午在用g++编译的时候报错如下:
zhang@debian:~/CuteCompiler$ g++ -std=c++11 test.cpp -o test
test.cpp: In function ‘int main(int, char**)’:
test.cpp:57:16: error: ‘setw’ is not a member of ‘std’
outFile << std::setw(4) << j << std::endl;
这个报错出现的原因是setw 虽然是std中的,但需要包括头文件:
#include <iomanip>