I am currently working on a little program for the Raspberry Pi. It involves some 7 segment displays. To be able to write more programs for this display I decided to extract the code that directly communicates with the GPIO's to a seperate .cpp and .h file.
Since the number of digits is variable I used a variable for that. The digits themselves are stored in a array consiting out of 8 bit integers.
This is what my setup looks like:
7_segment.h:
extern const uint8_t numDigits;
extern uint8_t digits[];
7_segment.cpp:
#include "7_Segment.h"
uint8_t digits[numDigits] = {0x00}; // Line 7
And the file with the "actual" program:
clock.cpp:
#include "7_Segment.h"
const uint8_t numDigits = 4;
When I execute
g++ clock.cpp 7_segment.cpp -o clock -std=c++0x -lwiringPi
I get this output:
7_segment.cpp:7:27: error: array bound is not an integer constant before ‘]’ token
What can I do to resolve this?