I get the following error when I use constant nVar
instead of a number.
constants.h:
extern const unsigned int nVar;
constants.cpp:
#include "constants.h"
const unsigned int nVar = 5;
main.cpp
#pragma once
#include "constants.h"
void foo(const double q[nVar])
{
// ...
}
Compiler:
array constant is not an integer constant before ']' token
expected ')' before ',' token
expected unqualified-id before 'const'
See Question&Answers more detail:os