This it's causing me a headache.
I have this error linking.
g++ -o node.o pathfinding.o prueba.o libmatrix.a -lm -lz -llog4cplus
Undefined symbols for architecture x86_64:
"operator<(Node const&, Node const&)", referenced from:
std::less<Node>::operator()(Node const&, Node const&) constin pathfinding.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [path] Error 1
That in the header of the class Node, out of the class declaration:
// Determine f_score in priority queue
//------------------------------------------
bool operator < (const Node &a, const Node &b);
// Determine f_score in priority queue
//------------------------------------------
bool operator > (const Node &a, const Node &b);
And in the source file (Node.cpp), I have the methods declaration:
#include "node.hpp"
// Determine f_score in priority queue
//------------------------------------------
bool operator < (const Node &a, const Node &b)
{
return a.getf() > b.getf();
}
// Determine f_score in priority queue
//------------------------------------------
bool operator > (const Node &a, const Node &b)
{
return a.getf() < b.getf();
}
Anyone knows where is the problem. I'm using g++ version 4.2.1 from OSX.
Thanks in advance.