I don't know why I'm getting this error, this is a post fix calculator for array use review, I'll include only the push functions to save post space. If i comment out the push/pops, the errors does not occur.
The fatal errors:
Code:
error LNK2019: unresolved external symbol "public: void __thiscall stack::pop(int &)" (?pop@stack@@QAEXAAH@Z) referenced in function _main
1>client.obj : error LNK2019: unresolved external symbol "public: void __thiscall stack::push(int)" (?push@stack@@QAEXH@Z) referenced in function _main
The client program (part of)
Code:
stack myStack;
int arg1; // this will hold the left operand.
int arg2; //this will hold the right operand.
int result; // result of every calculation, to be pushed onto stack.
int m;
int main()
{
string s1;
cout << "Input the numbers followed by operator(s): " << endl;
cin >> s1;
for (int i=0;s1[i]!='\0';i++)
{
if (isdigit(s1[i])){ //used isdigit to check if number, if true; push.
m = (int)s1[i];
cout << m << endl;
myStack.push(m);
}else if(s1[i]=='+'){
myStack.pop(arg1); //pops operand off top of stack and into arg1 which is a int data
...........................................
The stack.h and stack.cpp PUSH code:
Code:
typedef int el_t; // the el_t type is int for now
// el_t is unknown to the client
class stack
{
private: // to be hidden from the client
el_t el[MAX]; // el is an array of el_t's --int's
.........................
void push(el_t);
......................cpp below
void stack::push(el_t n)
{
if (isFull())
throw Overflow();
else{
top++;
el[top] = n;
}
}