Error: two or more data types in declaration of 'setup'.

Hello. I have an L298P and Arduino Leonardo that I’m trying to use to drive a stepper motor, but I keep getting this error:

"Arduino: 1.8.1 (Windows 10), Board: “Arduino Leonardo”

Probeer_shield:112: error: two or more data types in declaration of ‘setup’

void setup()

^

C:\User\Documents\Arduino\Probeer_shield\Probeer_shield.ino:11:11: warning: ISO C++ forbids declaration of ‘MotorsOff’ with no type [-fpermissive]

MotorsOff()

^

exit status 1
two or more data types in declaration of ‘setup’"

Any idea what could be causing this?

Probeer_shield.ino (2.39 KB)

Putting the function return type on the same line as name as the function is more conventional.

and what does this line do ?

int *steps[NUM_STEPS] = {(int *)Step0,(int *)Step1,(int *)Step2,(int *)Step3,(int *)Step4,(int *)Step5,(int *)Step6,(int *)Step7};

UKHeliBob:
Putting the function return type on the same line as name as the function is more conventional.

and what does this line do ?

int *steps[NUM_STEPS] = {(int *)Step0,(int *)Step1,(int *)Step2,(int *)Step3,(int *)Step4,(int *)Step5,(int *)Step6,(int *)Step7};

looking like he casts the pointer to type int* so that he can cast it back to iterate over the array of functions, it seems.

OP you can define an array of function pointers like this:

void (*foo[NUM_STEPS])(void) = {Step0, Step1, ..., ...};

and easily iterate over the functions:

void funct1()
{
  Serial.println("Function 1");
}

void funct2()
{
  Serial.println("Function 2");
}

void (*foo[])(void) = {funct1, funct2};

void setup() 
{
  Serial.begin(9600);
  for(int i = 0; i < sizeof(foo)/sizeof(foo[0]); i++) . // we know that the size of a pointer is two bytes, but this is an extensible approach
  {
    foo[i]();
  }

}

void loop() {
  // put your main code here, to run repeatedly:

}