Non_class Type?

OK, I have striped the program down to this, with no resolution.

/**********************************************************************

#Includes

***********************************************************************/
#include <Arduino.h>
#include "Water_Level.h"
// #include "Switches.h"

/**********************************************************************

clSwitches CLASS
Handles the presses of the switches

***********************************************************************/
enum eSwitch_ST {
SW_Init_ST = 0,
SW_WaitingForNotPressed_ST,
SW_NotPressed_ST,
SW_Pressed_ST
};
class clOffsetSwitch
{
public:
eSwitch_ST Switch_ST;
ULONG Switch_HoldTime;

    clOffsetSwitch();
    void        Run( void );

};

/**********************************************************************

Globals

*/
bool OffsetSwitchWasPressed;
/

Library functions

*/
/

#includes

***********************************************************************/
// #include "Switches.h"

/**********************************************************************

clOffsetSwitch CLASS
Handles the presses of the buttons

***********************************************************************/
clOffsetSwitch::clOffsetSwitch( ) {
Switch_ST = SW_Init_ST;
};

/**********************************************************************

clOffsetSwitch CLASS
Handles the running the buttons

***********************************************************************/
void clOffsetSwitch::Run( void ) {
switch ( Switch_ST ) {
case SW_Init_ST:
break;

    case  SW_WaitingForNotPressed_ST:
        break;

    case  SW_NotPressed_ST:
        break;

    case  SW_Pressed_ST:
        break;

    default:
        // Switch_ST = SW_Init_ST;
        break;

}

};

/**********************************************************************

Global Variables

***********************************************************************/
clOffsetSwitch OffsetCalSwitch();

/**********************************************************************

setup() function
Things done at startup

***********************************************************************/
void setup() {
}

/**********************************************************************

loop() function
Things done continuously, over and over

***********************************************************************/
void loop() {
OffsetCalSwitch.Run();
}

And an .H file of:
/**********************************************************************

#Includes

***********************************************************************/
#include <Arduino.h>
#include "Water_Level.h"
// #include "Switches.h"

/**********************************************************************

clSwitches CLASS
Handles the presses of the switches

***********************************************************************/
enum eSwitch_ST {
SW_Init_ST = 0,
SW_WaitingForNotPressed_ST,
SW_NotPressed_ST,
SW_Pressed_ST
};
class clOffsetSwitch
{
public:
eSwitch_ST Switch_ST;
ULONG Switch_HoldTime;

    clOffsetSwitch();
    void        Run( void );

};

/**********************************************************************

Globals

*/
bool OffsetSwitchWasPressed;
/

Library functions

*/
/

#includes

***********************************************************************/
// #include "Switches.h"

/**********************************************************************

clOffsetSwitch CLASS
Handles the presses of the buttons

***********************************************************************/
clOffsetSwitch::clOffsetSwitch( ) {
Switch_ST = SW_Init_ST;
};

/**********************************************************************

clOffsetSwitch CLASS
Handles the running the buttons

***********************************************************************/
void clOffsetSwitch::Run( void ) {
switch ( Switch_ST ) {
case SW_Init_ST:
break;

    case  SW_WaitingForNotPressed_ST:
        break;

    case  SW_NotPressed_ST:
        break;

    case  SW_Pressed_ST:
        break;

    default:
        // Switch_ST = SW_Init_ST;
        break;

}

};

/**********************************************************************

Global Variables

***********************************************************************/
clOffsetSwitch OffsetCalSwitch();

/**********************************************************************

setup() function
Things done at startup

***********************************************************************/
void setup() {
}

/**********************************************************************

loop() function
Things done continuously, over and over

***********************************************************************/
void loop() {
OffsetCalSwitch.Run();
}

I am getting an error message:
0_01\Water_Level_R0_01\Water_Level_R0_01.ino: In function 'void loop()':
C:\Users\jacks\OneDrive\ERG\Water Level\Design\Software\Rev 0_01\Water_Level_R0_01\Water_Level_R0_01.ino:112:21: error: request for member 'Run' in 'OffsetCalSwitch', which is of non-class type 'clOffsetSwitch()'
OffsetCalSwitch.Run();
^~~

exit status 1

Compilation error: request for member 'Run' in 'OffsetCalSwitch', which is of non-class type 'clOffsetSwitch()'

Obviously, the project is much bigger, but this fails for me.
Do you get the same?
What am I doing wrong?

try this

clOffsetSwitch OffsetCalSwitch;

If the constructor has no arguments, the object must be initialized without empty brackets after the name

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

OMG! WTF! That did it!
40 Years of OOP programming, and I never had to do that!
Thanks!

Originally, I had two switch pins.
So I made a generic function to handle both.
Obviously, with a change in the pin_number. That's where my problems started.
How should I do the constructor to accept the "Pin Number"?

It's not solved till it's resolved!

So, how do we do a Constructor with a parameter passed?

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