I'm having an issue with compiling libpoker into my app. I'm trying to
use the eval.c example to just evaluate a hand with the 2 hold cards
and 5 community cards. It makes the object just fine but then when it
trys to link it in I get undefined references.
mzupan@homer:~/poker/server$ make
g++ -Wl,-rpath,/usr/lib/qt/lib -o server holdemEval.o server.o
-L/usr/lib/qt/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
./lib/libpoker.a
holdemEval.o(.text+0x6b8): In function
`holdemEval::holdemEval[not-in-charge]()':
: undefined reference to `GenericDeck_maskString(Deck*, void*)'
holdemEval.o(.text+0x6f5): In function
`holdemEval::holdemEval[not-in-charge]()':
: undefined reference to `GenericDeck_maskString(Deck*, void*)'
holdemEval.o(.text+0xfd8): In function
`holdemEval::holdemEval[in-charge]()':
: undefined reference to `GenericDeck_maskString(Deck*, void*)'
holdemEval.o(.text+0x1015): In function
`holdemEval::holdemEval[in-charge]()':
: undefined reference to `GenericDeck_maskString(Deck*, void*)'
collect2: ld returned 1 exit status
make: *** [server] Error 1
mzupan@homer:~/poker/server$
The function seems to be in libpoker
mzupan@homer:~/poker/server$ nm -a lib/libpoker.a | grep
GenericDeck_maskString
00000110 T GenericDeck_maskString
mzupan@homer:~/poker/server$
Here is the same source I'm using. I'm taking the eval.c and trying to
put it into a class
holdemEval.h
-----------------
#include <stdio.h>
#include <stdlib.h>
#include "poker_defs.h"
#include "inlines/eval.h"
class holdemEval {
public:
holdemEval();
~holdemEval();
private:
};
holdemEval.cpp
-------------------
#include "holdemEval.h"
holdemEval::holdemEval() {
int gNCards;
CardMask gCards;
int gLow=0;
int gHighLow=0;
HandVal handval;
LowHandVal low;
gNCards = 0;
CardMask_RESET(gCards);
//parseArgs(argc, argv);
if (!gLow) {
handval = Hand_EVAL_N(gCards, gNCards);
printf("%s: ", Deck_maskString(gCards));
//HandVal_print(handval);
//printf("\n");
};
}
holdemEval::~holdemEval() {
}
it dies if i have printf("%s: ", Deck_maskString(gCards)); in the
source.. so its something to do with Deck_masString.. but I can't
figure it out
ALso I have tried to set init gCards.. I just left a lot out to make
it easier to read
Thanks
Mike