Hey guys, first I'd like to thank you for all your help in the past. Anyway, when I compile I get a whole bunch of "undefined reference to" and then a function call. I have these functions defined, and the appropriate files included. For example
"main.o(.text+0x235):/home/bbare/converting/c/main.cpp:68: undefined reference to `Convert_and_Score(int, double, int, double, double&)'"
in main I have #include "In_out.h"
void Convert_and_Score(int chrom_num1, double cM_percent1, int chrom_num2, double cM_percent2, double &outscore);
the call in main that the error is referencing:
and those PGA functions are also undefined references yet I have the file that they are defined in included...
double fChromNumOne = PGAGetRealAllele(ctx, p, pop, 1);
double fChromNumTwo = PGAGetRealAllele(ctx, p, pop, 3);
int iChromNumOne = (int)(fChromNumOne * NUM_CHROM);
int iChromNumTwo = (int)(fChromNumTwo * NUM_CHROM);
double loc1 = PGAGetRealAllele(ctx, p, pop, 2);
double loc2 = PGAGetRealAllele(ctx, p, pop, 4);
score = 0;
Convert_and_Score(iChromNumOne, loc1, iChromNumTwo, loc2, score);
Okay, you have the header...but are those functions defined anywhere? A header should only give you the declarations, not the definitions, so you need to link with a library or an implementation source file.
Sorry, yes, the declarations are in the header. The defintions are in the file of the same name just .cpp extension.
In_out.o: In_out.h In_out.cpp
g++ $(FLAGS) -c In_out.cpp
ga_ee: math_utils.o calc_subs.o EM.o EE_utils.o In_out.o main.o
g++ math_utils.o calc_subs.o EM.o EE_utils.o main.o -o ga_ee
> g++ math_utils.o calc_subs.o EM.o EE_utils.o main.o -o ga_ee
I notice you don't have In_out.o included on this line. It is included on the line above this one however.
yay! stupid mistakes are so much better. easier to fix!