Error during compilation using multiple files: "array bound is not an integer constant before ']' token"

Hi Ray, thanks for the idea!
I am trying to keep everything as "contained" as possbile, in the sense that all variables regarding each robot are within the "Robo...".h and "Robo...".cpp, this way, changing the include (only) in the main changes the robot I am creating code for.
Because of that I tried to keep all the definitions in "RoboChassiDeGrilo.cpp". I only defined the number of ultrasonic sensors in the header file because otherwise the compiler could not know the size of the array of ultrasonic sensor data in the main. By defining the variable directly in the header file, the compiler worked normally.
The solution for this problem, however, it is not so clear to me. One alternative to this definition in the header maybe could be creating a data type in "RoboChassiDeGrilo.cpp"? Or would the header guards be sufficient?
Anyway, the insights of the future are very interesting since I want to work in this code slow but steady. Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.