I'm writing a project about the alpha-beta prunning. And when I run it in xcode, i get Symbol referencing error:

  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)

some of my code :

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;
}
有帮助吗?

解决方案

You have a typo:

int eval(Node ptr[])

is how the function is defined, but you call

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

later - remember that C and C++ are case-sensitive.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top