在这个函数中:
#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;
}