[galib] VS2005 Linker Errors with GARealAllele
Steven Bilton
swb04 at doc.ic.ac.uk
Sat Jan 26 14:04:29 EST 2008
Hey,
I'm having issues compiling the library under VS2005 when using the
GARealAllele. I've read about a few problems that relate to requiring
casts, but I'm not really sure where they would be needed.
The errors I get are an array of linker errors when including
GARealGenome.h along the lines of:
6>GARealGenome.obj : error LNK2005: "public: float __thiscall
GAAlleleSet<float>::allele(void)const "
(?allele@?$GAAlleleSet at M@@QBEMXZ) already defined in MyClass.obj
Not including GARealGenome.h of course then causes it to default to the
definition in GAAllele.C to be used, giving the undefined
allele(unsigned int) error and breaking it.
At present, it will not compile with the following:
------------------
#include "ga/MyClass.h" // Has no GA related headers
inside.
#include "ga/ga.h"
#include "ga/GARealGenome.h"
#include "console/console.h" // Used for other stuff not
related to GA
#include "game/shapeBase.h" // Used for other stuff not related
to GA
#include <windows.h> // Used for other stuff not
related to GA
#define INSTANTIATE_REAL_GENOME
float fitnessFunction(GAGenome& g)
{
return 0;
}
void MyClass::run()
{
GARealAlleleSetArray alleles;
alleles.add(0,1);
GARealGenome genome(alleles, fitnessFunction);
}
------------------
Any pointers appreciated.
Cheers
Steve
More information about the galib
mailing list