No member function declared in class - error with basic compile
c++, compiler-errors, header
Solution
I had a similar problem, and solved it by removing the [header name].gch file that had been generated next to the header, and which apparently had been corrupted. Maybe you can try that?
Problem
Getting this error when compiling a basic class and header. Not sure if I'm missing something obvious? Can provide any additional details if needed. Note: I added `#include <string>` in Event.h and the error remains. Event.cpp ``` #include "Event.h" #include <string> std::string Event::getLabel() { return label; } ``` Event.h ``` #ifndef EVENT_H #define EVENT_H #define EVENT_STOP 0 #define EVENT_START 1 class Event { private: protected: double time; std::string label; int type; // EVENT_START OR EVENT_STOP public: std::string getLabel(); }; #endif ``` compile and error ``` g++ -c -Wall -pedantic correngine.cpp g++ -c -Wall -pedantic CSVManager.cpp g++ -c -Wall -pedantic ServerEvent.cpp g++ -c -o UPSEvent.o UPSEvent.cpp g++ -c -Wall -pedantic CorrelationEngineManager.cpp g++ -c -Wall -pedantic Event.cpp Event.cpp:4: error: no ‘std::string Event::getLabel()’ member function declared in class ‘Event’ make: *** [Event.o] Error 1 ```