As explained above i have a problem making classes.I am getting this error:
C:\Users\USER\AppData\Local\Temp\ccj3stv6.o main.cpp:(.text+0x15): undefined reference to 'plate::plate()'
C:\Users\USER\AppData\Local\Temp\ccj3stv6.o main.cpp:(.text+0x21): undefined reference to 'plate::SayHello()'
E:\c++\proje16\collect2.exe [Error] ld returned 1 exit status
main.cpp
#include <iostream>
#include "plate.h"
using namespace std;
int main () {
plate pobj;
pobj.SayHello();
}
plate.cpp
#include <iostream>
#include "plate.h"
using namespace std;
plate::plate(){
}
void plate::SayHello () {
cout << "hello";
}
plate.h
#ifndef PLATE_H
#define PLATE_H
class plate
{
public:
plate();
void SayHello();
};
#endif
error,main.cpp,plate.cpp,plate.h combined as an image
using #include "plate.cpp"
instead of #include "plate.h"
helps but i am not sure if thats a good fix or not.
I am using dev-c++ 5.11.I am not that experienced in coding.I done some research before posting this question but couldn't solve my problem.