Created
May 1, 2019 13:25
-
-
Save savolla/193ea4f6ffc7138aed58aedc3c775731 to your computer and use it in GitHub Desktop.
getting error when compiling the code below
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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).