IOMANIP 错误或“setw”未在此范围内声明
iomanip errors or ‘setw’ was not declared in this scope
在此函数中:
#include <iostream>
using namespace std;
extern const int M;
void outnum(int* &arr)
{
for (int i=0; i<M; i++)
cout << setw(4) << arr[i];
cout << endl;
}
我收到错误
error: ‘setw’ was not declared in this scope
cout << setw(4) << arr[i];
^
当我尝试包含iomanip时,在编译过程中出现了很多这样的行:
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
这对 Ubuntu 来说有什么特别之处吗?
主文件:
#include <iostream>
#include <locale>
extern const int M=5;
extern const int N=4;
int **makemas(int m, int n);
void output(int** &array, int m, int n);
int *number(int** &array, int n, int m);
void outnum(int* &arr);
int main()
{
int **a, **b;
int *anum, *bnum;
...
cout<<" Number of minus elements in A:"<<endl;
outnum(anum);
cout<<" Number of minus elements in B:"<<endl;
outnum(bnum);
return 0;
}
您需要
添加#include <iomanip>
才能使用std::setw()
。如果你在这方面遇到错误,那么其他事情正在发生,要么是 Ubuntu 的 STL 搞砸了,要么是其他东西干扰了编译。
相关文章:
- 错误:未在此范围内声明'reverse'
- 错误:"imread"未在此范围内声明
- 未在此范围内声明错误 'xy'
- Socklen_t未在此范围内声明
- 错误:'[' 之前预期的非限定 id 和错误:'users'未在此范围内声明
- "Main"已在当前范围内声明
- c++ 变量在宏的扩展中没有在这个范围内声明
- C++ 在编译过程中 strtok 函数 Eclipse 说没有在范围内声明?
- 'num1'未在此范围内声明
- 如何找到在本地范围内声明的变量的地址?
- NT状态未在此范围内声明
- 变量未在此范围内声明 数组线性搜索
- 包含文件中的 Typdef "未在此范围内声明"
- 'ClassName'和'ClassInstance'未在此范围内声明
- C++ 中的类之间的数据重新循环 - 错误:'<class name>'未在此范围内声明
- 代码作为 C 文件工作,但不作为C++文件,错误:'__builtin_types_compatible_p'未在此范围内声明
- 如何修复错误:"vreinterpretq_u32_f64"未在此范围内声明 - 在Android上使用Eigen构建
- 如何修复C++中的"arrStud未在此范围内声明"错误
- 错误:"SHGetKnownFolderPath"未在此范围内声明
- 错误:'Sprite'未在此范围内声明