Compilation error: request for member '.. in which is of non-class type

I'm looking cross-eyed at this simple piece of code with the compilation error :

"ESP32CAM_PIR_01_Deepak:13:11: error: request for member 'GetTS' in 'it', which is of non-class type 'GetTimeStamp()'
ts = it.GetTS();
^
exit status 1
request for member 'GetTS' in 'it', which is of non-class type 'GetTimeStamp()'"

I’m missing something obvious :frowning:

Any help would be appreciated.

main ino file

#include "GetTimeStamp.h"

void setup()
{

  Serial.begin(115200);
  Serial.println("\nRunning version ESP32CAM_PIR_01_Deepak");

  GetTimeStamp it();

  String ts;
  ts = it.GetTS();

}

void loop()
{
}

GetTimeStamp.h

#ifndef HEADER_GetTimeStamp
#define HEADER_GetTimeStamp

#include "Arduino.h"

class GetTimeStamp
{
  private:

  public:

    String GetTS( void );

};

#endif

GetTimeStamp.cpp

include "GetTimeStamp.h"

String GetTimeStamp::GetTS( void )
{
  return "abc";
}

Try:

GetTimeStamp it;

instead of

GetTimeStamp it();

That fixed it !

Thankyou.

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