Hi,
I am trying to learn how to place classes in separate files.My main code is :
#include <iostream>
#include "Burrito.h"
using namespace std;
int main()
{
Burrito bo;
return 0;
}
My Burrito header file is :
#ifndef BURRITO_H
#define BURRITO_H
class Burrito
{
public:
Burrito();
protected:
private:
};
#endif // BURRITO_H
My Burrito Class is:
#include "Burrito.h"
#include <iostream>
using namespace std;
Burrito::Burrito()
{
cout<<"Tanmay Nath NBRC"<<endl;
}
I am using Ubuntu and I need to compile my main.cpp .I am using gcc main.cpp..Unfortunately it is giving me following errors:
/tmp/cc66TksP.o: In function `main':
main.cpp
.text+0x10): undefined reference to `Burrito::Burrito()'
/tmp/cc66TksP.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp
.text+0x3e): undefined reference to `std::ios_base::Init::Init()'
main.cpp
.text+0x43): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cc66TksP.o
.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Please provide me the steps to compile it in correct manner.
Thanks