Dans cette fonction:erreurs de iomanip ou « setw » n'a pas été déclarée dans ce champ
#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;
}
Je reçois une erreur
error: ‘setw’ was not declared in this scope
cout << setw(4) << arr[i];
^
Lorsque je tente d'inclure iomanip, lors de la compilation apparaissent un beaucoup de lignes comme ceci:
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
Est-ce quelque chose de spécial pour Ubuntu? fichier principal
:
#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;
}
Lorsque l'erreur fait ressortir 'std :: setw', c'est une bonne idée de trouver une [référence] (http://en.cppreference.com/w/cpp/io/manip/setw) dessus. – chris
Peut-être que c'est un problème avec ubuntu, mais j'en doute vraiment. [Ici, il compile bien.] (Http://ideone.com/yp8Jee) –