//>>>>Stack.cpp
#include <iostream>
#include "Stack.h"
usingnamespace std;
int Stack::arr[10];
int Stack::top = 0;
void Stack::push(int num)
{
if(top >= 10)
cout << "Stack overflow" << endl;
else
arr[top++] = num;
}
int Stack::pop()
{
int result = NULL;
if(top <= 0)
cout << "Stack UnderFlow" << endl;
else
result = arr[--top];
return result;
}
The error are :
/tmp/cc66LZ7A.o: In function `main':
Main.cpp:(.text+0x73): undefined reference to `Stack::pop()'
Main.cpp:(.text+0x96): undefined reference to `Stack::push(int)'
Main.cpp:(.text+0xa0): undefined reference to `Stack::push(int)'
Main.cpp:(.text+0xa5): undefined reference to `Stack::pop()'
collect2: ld returned 1 exit status
It is to be noted that the files are getting compiled but are the error kicks in when the linking starts.