Referencing .h and .cpp class files
Posted: Sun Jan 26, 2020 2:57 am
I'm having trouble referencing class methods from the related .cpp file and hoping for some idea as to why it's failing.
I've created an exampleClass with a .h file that includes:
and I've created the associated exampleClass.cpp file that has:
However, in my main when after I create an object of the class, I call the class method and get the error:
(.literal.app_main+0x20): undefined reference to `exampleClass::print()'
main/libmain.a(main.cpp.obj): In function `app_main':
C:...\Project\build/../main/custom_accData.cpp:53: undefined reference to `exampleClass::print()'
Does anyone know why this is failing? Thanks for any help.
I've created an exampleClass with a .h file that includes:
- extern "C" {
- void app_main(void);
- }
- class exampleClass {
- public:
- void print();
- private:
- };
- #include "exampleClass.h"
- void exampleClass::print() {
- }
However, in my main when after I create an object of the class, I call the class method and get the error:
(.literal.app_main+0x20): undefined reference to `exampleClass::print()'
main/libmain.a(main.cpp.obj): In function `app_main':
C:...\Project\build/../main/custom_accData.cpp:53: undefined reference to `exampleClass::print()'
Does anyone know why this is failing? Thanks for any help.