Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 119 characters in body
Source Link
ptf
  • 111
  • 6

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

EDIT 2: So, I've solved the problem of passing the array. I changed the parameter in the constructor to MIDICommand** MIDICommands, and I just pass a pointer to the array.

Now the constructor looks like this:

Preset::Preset(char* presetName, MIDICommand** MIDICommands)
{
  Serial.println(MIDICommands[0]->getProgramChange());

  _presetName = presetName;
  _MIDICommands = *MIDICommands;

  Serial.println(_MIDICommands[0]->getProgramChange());
}

I'm getting an error on the second Serial.println, telling me it is a non-pointer type. I'd like it to be a pointer, so that's what I am looking at now.

_MIDICommands is now declared like this: MIDICommand* _MIDICommands.

EDIT 3: When I try to loop through the array now, it seems I have lost the second element, and have only the first.

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

EDIT 2: So, I've solved the problem of passing the array. I changed the parameter in the constructor to MIDICommand** MIDICommands, and I just pass a pointer to the array.

Now the constructor looks like this:

Preset::Preset(char* presetName, MIDICommand** MIDICommands)
{
  Serial.println(MIDICommands[0]->getProgramChange());

  _presetName = presetName;
  _MIDICommands = *MIDICommands;

  Serial.println(_MIDICommands[0]->getProgramChange());
}

I'm getting an error on the second Serial.println, telling me it is a non-pointer type. I'd like it to be a pointer, so that's what I am looking at now.

_MIDICommands is now declared like this: MIDICommand* _MIDICommands.

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

EDIT 2: So, I've solved the problem of passing the array. I changed the parameter in the constructor to MIDICommand** MIDICommands, and I just pass a pointer to the array.

Now the constructor looks like this:

Preset::Preset(char* presetName, MIDICommand** MIDICommands)
{
  Serial.println(MIDICommands[0]->getProgramChange());

  _presetName = presetName;
  _MIDICommands = *MIDICommands;

  Serial.println(_MIDICommands[0]->getProgramChange());
}

I'm getting an error on the second Serial.println, telling me it is a non-pointer type. I'd like it to be a pointer, so that's what I am looking at now.

_MIDICommands is now declared like this: MIDICommand* _MIDICommands.

EDIT 3: When I try to loop through the array now, it seems I have lost the second element, and have only the first.

added 732 characters in body
Source Link
ptf
  • 111
  • 6

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

EDIT 2: So, I've solved the problem of passing the array. I changed the parameter in the constructor to MIDICommand** MIDICommands, and I just pass a pointer to the array.

Now the constructor looks like this:

Preset::Preset(char* presetName, MIDICommand** MIDICommands)
{
  Serial.println(MIDICommands[0]->getProgramChange());

  _presetName = presetName;
  _MIDICommands = *MIDICommands;

  Serial.println(_MIDICommands[0]->getProgramChange());
}

I'm getting an error on the second Serial.println, telling me it is a non-pointer type. I'd like it to be a pointer, so that's what I am looking at now.

_MIDICommands is now declared like this: MIDICommand* _MIDICommands.

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

EDIT 2: So, I've solved the problem of passing the array. I changed the parameter in the constructor to MIDICommand** MIDICommands, and I just pass a pointer to the array.

Now the constructor looks like this:

Preset::Preset(char* presetName, MIDICommand** MIDICommands)
{
  Serial.println(MIDICommands[0]->getProgramChange());

  _presetName = presetName;
  _MIDICommands = *MIDICommands;

  Serial.println(_MIDICommands[0]->getProgramChange());
}

I'm getting an error on the second Serial.println, telling me it is a non-pointer type. I'd like it to be a pointer, so that's what I am looking at now.

_MIDICommands is now declared like this: MIDICommand* _MIDICommands.

added 358 characters in body
Source Link
ptf
  • 111
  • 6

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

I have a constructor which looks like this:

Preset::Preset(char* presetName, MIDICommand* MIDICommands[])
  _presetName = presetName;
  _MIDICommands = MIDICommands;
}

_MIDICommnads is declared like this: MIDICommand* _MIDICommands[];.

When run, this throws the error below on the second line in the constructor:

incompatible types in assignment of 'MIDICommand**' to 'MIDICommand* [0]'

Why do I need to declare _MIDICommands as MIDICommands**, and not MIDICommand* _MIDICommands[]?

The array I pass is declared like this:

MIDICommand* one =  new MIDICommand(1, 2);
MIDICommand* two =  new MIDICommand(2, 2);

MIDICommand* MIDICommandsA[] = { one, two };

EDIT: When I pass in an array, should I just use MIDICommand* MIDICommands, or do I need the [] at the end? Now I've taken them off, but then I get trouble with passing the array.

It doesn't find a matching function to call. Basically, this MIDICommand* MIDICommandsA[] = { one, two }; doesn't match this MIDICommand* MIDICommands parameter.

Source Link
ptf
  • 111
  • 6
Loading