符号引用错误

时间:2012-10-29 22:35:30

标签: c++ alpha-beta-pruning

编写关于alpha-beta修剪的项目。当我在xcode中运行它时,我得到符号引用错误:

  Undefined symbols for architecture x86_64:
  "Eval(Node*)", referenced from:
      AlphaBeta(int, int&, int, int, int, Node*) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的一些代码:

struct Node
{
    char name[1];
    int empty;// YES or NO
    double  value;
};

int eval(Node ptr[]) {
 //some stuff   
}

int AlphaBeta (int player, int &bestMove, int alpha, int beta, int bsize, Node ptr[]) {
//some stuff, and then i call Evaluation function

int value = Eval(ptr);
//some stuff
}
int main (int argc, const char * argv[])
{

    int size  = 4;
    Node board[size*size];
// some stuff
    int score = AlphaBeta(RED, move, a, b, size, board);
    return 0;
}

1 个答案:

答案 0 :(得分:3)

你有一个错字:

int eval(Node ptr[])

是如何定义函数,但是调用

Eval(ptr);
^
+- this was a lowercase 'e' in the definition!

以后 - 记住C和C ++是区分大小写的。