Skip to content

Instantly share code, notes, and snippets.

@savolla
Created May 1, 2019 13:25
Show Gist options
  • Save savolla/193ea4f6ffc7138aed58aedc3c775731 to your computer and use it in GitHub Desktop.
Save savolla/193ea4f6ffc7138aed58aedc3c775731 to your computer and use it in GitHub Desktop.
getting error when compiling the code below
// my compilation command: g++ -o burrito main.cpp
// ERROR:
// /usr/bin/ld: /tmp/ccruqflI.o:A in function `main':
// main.cpp:(.text+0x1f): undefined reference to `Burrito::Burrito()'
// collect2: error: ld returned 1 exit status
// Burrito.h
#ifndef BURRITO_H
#define BURRITO_H
class Burrito
{
public:
Burrito();
};
#endif
// Burrito.cpp
#include "Burrito.h"
#include <iostream>
using namespace std;
Burrito::Burrito()
{
cout << "I am a banana" << endl;
}
// main.cpp
#include "Burrito.h"
#include <iostream>
using namespace std;
int main(void)
{
Burrito b0;
return 0;
}
@apache-777
Copy link

You should create a project and make a console application and then do all the things of making the class in the same directory etc.
If you dont understand what I'm saying, then e-mail me on (tashfeen.haider345@gmail.com).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment