separate files for classes
I am trying to write code with separate files for classes right now i have 3 files: ----------------------------------------------------------- Birthday.h ----------------------------------------------------------- #ifndef BIRTHDAY_H #define BIRTHDAY_H class Birthday { public: Birthday(int d, int m, int y); void printdate(); protected: private: int day; int month; int year; }; #endif // BIRTHDAY_H ----------------------------------------------------------- Birthday.cpp ----------------------------------------------------------- #include "Birthday.h" Birthday::Birthday(int d, int m, int y) : day(d), month(m), year(y) { //ctor } void Birthday::printdate() { cout<<<<day<<"/"<<month<<"/"<<year<<endl; } ----------------------------------------------------------- main.cpp ----------------------------------------------------------- #include <iostream> #include "Birthday.h" using namespace std; int main() { Birthday bd(7, 2, 1992); bd.printdate(); } ----------------------------------------------------------- when i build i get the error: C:\Users\nisha\AppData\Local\Temp\ccCJXkgP.o:main.cpp:(.text+0x26): undefined reference to `Birthday::Birthday(int, int, int)' C:\Users\nisha\AppData\Local\Temp\ccCJXkgP.o:main.cpp:(.text+0x32): undefined reference to `Birthday::printdate()' collect2.exe: error: ld returned 1 exit status please help!