0

I am trying to use stack's and queue's based on linked lists and am getting the following error:

Undefined symbols for architecture x86_64:
  "stack::push(double)", referenced from:
      Calculator::method1(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in Calculator.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main] Error 1

#include "Calculator.h"
#include "queue.h"
#include "stack.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int Calculator::method1(std::string eq)
{

stack s;


int size = eq.size();
for (int o = 0; 0 < size; size--)
{
    if (isdigit(eq[o]))
    {
        double t = atoi (eq.c_str());
        s.push(t);
    }
    else
    {
        queue q;

    }
}
//std::cout << eq.size() << std::endl;
return 1;

}

this is my make file

all:main

data.o: data.h data.cpp
    g++ -std=c++0x -g -c data.cpp

node.o: node.h node.cpp
    g++ -std=c++0x -g -c node.cpp

linklist.o: linklist.h linklist.cpp
    g++ -std=c++0x -g -c linklist.cpp

queue.o: queue.h queue.cpp
    g++ -std=c++0x -g -c queue.cpp

stack.o: stack.h stack.cpp
    g++ -std=c++0x -g -c stack.cpp

Calculator.o: Calculator.h Calculator.cpp
    g++ -std=c++0x -g -c Calculator.cpp

main.o: main.cpp
    g++ -std=c++0x -g -c main.cpp

main: data.o node.o linklist.o queue.o Calculator.o main.o
    g++ -std=c++0x -g data.o node.o linklist.o queue.o Calculator.o main.o -o main

clean:
    rm *.o *~ main

If code from other classes is needed please let me know. Any help is appreciated.

T.C.
  • 133,968
  • 17
  • 288
  • 421
user3316874
  • 223
  • 2
  • 6
  • 10
  • Well, did you pass your stack implementation to the compiler? – T.C. Jun 25 '14 at 22:41
  • I'm pretty sure I did, I added my make file. – user3316874 Jun 25 '14 at 22:45
  • `g++ -std=c++0x -g data.o node.o linklist.o queue.o Calculator.o main.o -o main` Where's `stack.o` in that list? – T.C. Jun 25 '14 at 22:46
  • I added stack but I still get an error Undefined symbols for architecture x86_64: "queue::queue()", referenced from: Calculator::method1(std::__1::basic_string, std::__1::allocator >) in Calculator.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [main] Error 1 – user3316874 Jun 25 '14 at 22:48

0 Answers0