function name not declared in this scope... but it is!

void loop()
{
commands->processCommandInput();
if (commands->commandsToBeProcessed() > 0) {
cmd = commands->getQueuedCommand();
executeCommand(cmd); <<<-- ERROR HERE
}

delay(100);
}

void executeCommand(Commands::command cmd) {
Serial.println("Processing Command");
}

Severity Description File Line Column Category
Warning In function void loop() D:\Users\Bob.ObigOne\Documents\Arduino\CommandHandler\CommandHandler.ino -1
Error 81:19: error: 'executeCommand' was not declared in this scope D:\Users\Bob.ObigOne\Documents\Arduino\CommandHandler\CommandHandler.ino 81
Warning executeCommand(cmd)

I have tried rebuilding this, cleaning the code, powering off and restarting, swearing, etc. Nothing has worked except (hopefully) asking for help.

I can't provide an exact solution since you haven't posted complete code but I'll have a try anyway.

In C++, the compiler must know about a function before it is called. For this reason you can add a "function prototype" which is simply a declaration of the function signature. This prototype tells the compiler "somewhere in my code I'm going to define this function". That's enough for the compiler.

The Arduino IDE automatically adds function prototypes to your sketch for any functions that don't have one already. Generally this works very reliably but in some rare cases function prototype generation is not done correctly or fails altogether. The solution is to simply add function prototypes for any problematic functions manually near the top of your sketch, before their first reference in the code.

void executeCommand(Commands::command cmd) {
   Serial.println("Processing Command");
}

I don't think that is a valid syntax for function parameter

arduino_new:

void executeCommand(Commands::command cmd) {

Serial.println("Processing Command");
}




I don't think that is a valid syntax for function parameter

sure it is... if the Commands::command type is public:

class Test {
  public:
    using funcPtr = void(*)(void);
};

void helloWorld(void){
  Serial.println("hello world");
}

void setup() {
  Serial.begin(9600);
  myFunction(helloWorld);
}

void loop() {
  
}

void myFunction(Test::funcPtr ptr) {
  ptr();
}

rhj4:

void loop()

{
commands->processCommandInput();
if (commands->commandsToBeProcessed() > 0) {
cmd = commands->getQueuedCommand();
executeCommand(cmd);  <<<-- ERROR HERE
}

delay(100);
}

void executeCommand(Commands::command cmd) {
Serial.println("Processing Command");
}

every line dereferences a pointer called commands, that is... except for here:

executeCommand(cmd);   <<<-- ERROR HERE

try:

commands->executeCommand(cmd);