Reputation: 1
Inside of this header file here
namespace seneca {
class TimeMonitor {
std::string m_EventName;
std::chrono::steady_clock::time_point m_EventTime;
public:
void startEvent(const char*);
Event stopEvent(); //no errors come up here but I suspect this is where everything is going wrong
};
}
The member function Event stopEvent()
is meant to create a class object of Event
type and return that object. I don't think that the implementation of the function is where my code breaks but I'll post it here:
namespace seneca {
seneca::Event TimeMonitor::stopEvent() {
return Event(m_EventName.c_str(), m_EventTime - std::chrono::steady_clock::now()); //This line gives me build errors for m_EventName and m_EventTime, calling them undeclared identifiers, even though visual studio recognises and autofills them when I start typing their names here
}
}
Then in main(), where I actually call the function, it gives "stopEvent() is not a member of seneca::TimeMonitor" at each point where I call it.
Notably this behaviour does not occur for any of my other methods or members in this class, void startEvent(const char*) works completely fine.
I've tried typing and retyping the declaration in the header file in case of those notorious invisible characters, but aside from that I genuinely have no idea what could be wrong with this.
Upvotes: 0
Views: 23