[galib] Multiple definitions in MS Visual Studio 2003, V7.1.3088

Mike Cooling m.cooling at auckland.ac.nz
Tue Apr 25 21:46:54 EDT 2006


Hi

 

I'm trying to compile an exercise (ex23.c) from Galib in MS Visual Studio
2003, V7.1.3088, on a Windows XP machine.

 

I've tried Kevin Druhan's solution, including changing the #includes to read
*.hpp *.cpp. I can get a very simple example to run fine this way.

 

However, with ex23.c I errors thus:

 

AutoTester error LNK2005: "int __cdecl GARealArithmeticCrossover(class
GAGenome const &,class GAGenome const &,class GAGenome *,class GAGenome *)"
(?GARealArithmeticCrossover@@YAHABVGAGenome@@0PAV1 at 1@Z) already defined in
AutoTester.obj

AutoTester error LNK2005: "int __cdecl GARealBlendCrossover(class GAGenome
const &,class GAGenome const &,class GAGenome *,class GAGenome *)"
(?GARealBlendCrossover@@YAHABVGAGenome@@0PAV1 at 1@Z) already defined in
AutoTester.obj

AutoTester error LNK2005: "int __cdecl GARealGaussianMutator(class GAGenome
&,float)" (?GARealGaussianMutator@@YAHAAVGAGenome@@M at Z) already defined in
AutoTester.obj

AutoTester error LNK2005: "public: __thiscall
GA1DArrayAlleleGenome<float>::GA1DArrayAlleleGenome<float>(class
GAAlleleSetArray<float> const &,float (__cdecl*)(class GAGenome &),void *)"
(??0?$GA1DArrayAlleleGenome at M@@QAE at ABV?$GAAlleleSetArray at M@@P6AMAAVGAGenome@
@@ZPAX at Z) already defined in AutoTester.obj

AutoTester error LNK2005: "public: __thiscall
GA1DArrayAlleleGenome<float>::GA1DArrayAlleleGenome<float>(unsigned
int,class GAAlleleSet<float> const &,float (__cdecl*)(class GAGenome &),void
*)"
(??0?$GA1DArrayAlleleGenome at M@@QAE at IABV?$GAAlleleSet at M@@P6AMAAVGAGenome@@@ZP
AX at Z) already defined in AutoTester.obj

AutoTester error LNK2005: "public: float __thiscall
GAAlleleSet<float>::allele(unsigned int)const "
(?allele@?$GAAlleleSet at M@@QBEMI at Z) already defined in AutoTester.obj

AutoTester error LNK2005: "public: float __thiscall
GAAlleleSet<float>::allele(void)const " (?allele@?$GAAlleleSet at M@@QBEMXZ)
already defined in AutoTester.obj

AutoTester error LNK2005: "public: virtual __thiscall
GA1DArrayAlleleGenome<float>::~GA1DArrayAlleleGenome<float>(void)"
(??1?$GA1DArrayAlleleGenome at M@@UAE at XZ) already defined in AutoTester.obj

AutoTester error LNK2005: "public: virtual char const * __thiscall
GA1DArrayAlleleGenome<float>::className(void)const "
(?className@?$GA1DArrayAlleleGenome at M@@UBEPBDXZ) already defined in
AutoTester.obj

AutoTester error LNK2005: "public: virtual int __thiscall
GA1DArrayAlleleGenome<float>::classID(void)const "
(?classID@?$GA1DArrayAlleleGenome at M@@UBEHXZ) already defined in
AutoTester.obj

AutoTester error LNK2005: "public: virtual int __thiscall
GA1DArrayAlleleGenome<float>::read(class std::basic_istream<char,struct
std::char_traits<char> > &)"
(?read@?$GA1DArrayAlleleGenome at M@@UAEHAAV?$basic_istream at DU?$char_traits at D@s
td@@@std@@@Z) already defined in AutoTester.obj

AutoTester fatal error LNK1169: one or more multiply defined symbols found

 

I have also tried leaving the .c files as .c files, setting the Project and
File options to /TP, and including the folder that contains the ./ga folder
in the Projects VC++ Directories (so I don't have to change

<ga/whatever.c> to "whatever.cpp". In this case I still get the above
errors.

 

What am I missing? If there is anyone out there using MS Vis Studio and can
help please let me know.

 

Thanks for your time,

Mike Cooling

PhD Student

Bioengineering Institute

University of Auckland

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20060426/8d2495e9/attachment.htm


More information about the galib mailing list