I was just wondering if anybody can help me with this and I am new to C++ and I am having a problem when I am separating the classes into different files.
The error I am getting when I compile the SepMain.cpp file is:
/usr/bin/ld: /tmp/cciHobHn.o: in function `main':
SepMain.cpp:(.text+0x23): undefined reference to `Sep::Sep()'
collect2: error: ld returned 1 exit status
The error I am getting when I compile the Sep.cpp file is:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
The error I am getting when I compile the Sep.h file is:
bash: /home/ishan/Coding/C++/Learn/tempCodeRunnerFile: Permission denied
so my codes have three files:
Sep.cpp
#include "Sep.h"
#include <iostream>
using namespace std;
Sep::Sep()
{
cout<<"hello"<<endl;
}
Sep.h
#ifndef SEP_H
#define SEP_H
class Sep
{
public:
Sep();
};
#endif
SepMain.cpp
#include "Sep.h"
#include <iostream>
using namespace std;
int main()
{
Sep ir;
return 0;
}