Keine Matching -Funktion für den Aufruf von 'fillwithrandomnum'
Kandidatenfunktion nicht lebensfähig: Keine bekannte Konvertierung von 'Double [10] [Global :: max_col]' 'to' to doppel (*) [) [Global: /> < /blockquote>
Wenn ich Globals :: max_col < /code> in eine Zahl (d. H. 10) ändere, funktioniert es ordnungsgemäß. Wie würde ich die Verwendung des Namespace Variablen Globals :: max_col ?
Code: Select all
#include "namespaces.h"
#ifndef MATRIX_H
#define MATRIX_H
void fillWithRandomNum(double[][Globals::MAX_COL], const int);
#endif
< /code>
NameSpaces.h:
#ifndef namespaces_h
#define namespaces_h
namespace Globals {
int MAX_COL = 10;
};
#endif
< /code>
Main.cpp:
#include
#include "Matrix.h"
#include "namespaces.h"
int main() {
double matrix[10][Globals::MAX_COL];
fillWithRandomNum(matrix, 10);
return 0;
}
< /code>
Ich habe versucht, Zeiger zu verwenden, indem ich die Funktionserklärung und den Code in Folgendes geändert habe, aber ich erhalte den gleichen Fehler: < /p>
void fillWithRandomNum(double (*matrix)[Globals::MAX_COL], const int);