架构x86_64的未定义符号:堆栈

时间:2014-06-25 22:39:27

标签: c++ compiler-errors

我正在尝试使用基于链接列表的堆栈和队列,并收到以下错误:

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;

}

这是我的make文件

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

如果需要其他课程的代码,请告诉我。任何帮助表示赞赏。

0 个答案:

没有答案