[galib] Problems Building the Examples with MS Visual C++ 2010

Kyriakos Vafiadis kvafiadis at uowm.gr
Sun Apr 10 07:11:49 EDT 2011


Hello from Greece,

I use Windows XP (SP3) and I compile GAlib 2.4.7 (and the examples  
included) with MS Visual C++ 2008 (express ed.) successfully.
Yesterday, I decided to upgrade and try MS Visual C++ 2010 (express  
ed.) with both Windows XP and Windows Vista, but some errors came up...
I had no problems building the static library. The problems came up  
with example 1.
I will paste the build output here:

------ Build started: Project: ga, Configuration: Release Win32 ------
   GA1DArrayGenome.cpp
   GA1DBinStrGenome.cpp
   GA2DArrayGenome.cpp
   GA2DBinStrGenome.cpp
   GA3DArrayGenome.cpp
   GA3DBinStrGenome.cpp
   GAAllele.cpp
   GABaseGA.cpp
   GABin2DecGenome.cpp
   gabincvt.cpp
   GABinStr.cpp
   GADCrowdingGA.cpp
   GADemeGA.cpp
   gaerror.cpp
   GAGenome.cpp
   GAIncGA.cpp
   GAList.cpp
   GAListBASE.cpp
   GAListGenome.cpp
   GAParameter.cpp
   Compiling...
   GAPopulation.cpp
   garandom.cpp
..\..\..\ga\garandom.cpp(69): warning C4244: '=' : conversion from  
'time_t' to 'unsigned long', possible loss of data
..\..\..\ga\garandom.cpp(315): warning C4244: '=' : conversion from  
'double' to 'float', possible loss of data
   GARealGenome.cpp
..\..\..\ga\GARealGenome.cpp(170): warning C4244: '+=' : conversion  
from 'double' to 'float', possible loss of data
..\..\..\ga\GARealGenome.cpp(187): warning C4244: '+=' : conversion  
from 'double' to 'float', possible loss of data
..\..\..\ga\GARealGenome.cpp(219): warning C4244: 'argument' :  
conversion from 'double' to 'const float', possible loss of data
..\..\..\ga\GARealGenome.cpp(220): warning C4244: 'argument' :  
conversion from 'double' to 'const float', possible loss of data
..\..\..\ga\GARealGenome.cpp(231): warning C4244: 'argument' :  
conversion from 'double' to 'const float', possible loss of data
..\..\..\ga\GARealGenome.cpp(264): warning C4244: 'initializing' :  
conversion from 'double' to 'float', possible loss of data
..\..\..\ga\GARealGenome.cpp(265): warning C4244: 'initializing' :  
conversion from 'double' to 'float', possible loss of data
..\..\..\ga\GARealGenome.cpp(283): warning C4244: 'initializing' :  
conversion from 'double' to 'float', possible loss of data
..\..\..\ga\GARealGenome.cpp(284): warning C4244: 'initializing' :  
conversion from 'double' to 'float', possible loss of data
   GAScaling.cpp
   GASelector.cpp
   GASimpleGA.cpp
   GASStateGA.cpp
   GAStatistics.cpp
   GAStringGenome.cpp
   GATree.cpp
   GATreeBASE.cpp
   GATreeGenome.cpp
   ga.vcxproj -> C:\galib247\projects\vcpp2010\Release\ga.lib
------ Build started: Project: ex1, Configuration: Debug Win32 ------
   ex1.cpp
ex1.obj : error LNK2019: unresolved external symbol "public: virtual  
__thiscall GA2DBinaryStringGenome::~GA2DBinaryStringGenome(void)"  
(??1GA2DBinaryStringGenome@@UAE at XZ) referenced in function _main
ex1.obj : error LNK2019: unresolved external symbol "public: virtual  
__thiscall GASimpleGA::~GASimpleGA(void)" (??1GASimpleGA@@UAE at XZ)  
referenced in function _main
ex1.obj : error LNK2019: unresolved external symbol "public: class  
GAGenome const & __thiscall GAStatistics::bestIndividual(unsigned  
int)const " (?bestIndividual at GAStatistics@@QBEABVGAGenome@@I at Z)  
referenced in function _main
ex1.obj : error LNK2019: unresolved external symbol "public: virtual  
int __thiscall GASimpleGA::populationSize(unsigned int)"  
(?populationSize at GASimpleGA@@UAEHI at Z) referenced in function _main
ex1.obj : error LNK2019: unresolved external symbol "public:  
__thiscall GASimpleGA::GASimpleGA(class GAGenome const &)"  
(??0GASimpleGA@@QAE at ABVGAGenome@@@Z) referenced in function _main
ex1.obj : error LNK2019: unresolved external symbol "public:  
__thiscall GA2DBinaryStringGenome::GA2DBinaryStringGenome(unsigned  
int,unsigned int,float (__cdecl*)(class GAGenome &),void *)"  
(??0GA2DBinaryStringGenome@@QAE at IIP6AMAAVGAGenome@@@ZPAX at Z) referenced  
in function _main
ex1.obj : error LNK2019: unresolved external symbol "void __cdecl  
GARandomSeed(unsigned int)" (?GARandomSeed@@YAXI at Z) referenced in  
function _main
ex1.obj : error LNK2019: unresolved external symbol "public: void  
__thiscall GAStatistics::flushScores(void)"  
(?flushScores at GAStatistics@@QAEXXZ) referenced in function "public:  
virtual void __thiscall GAGeneticAlgorithm::evolve(unsigned int)"  
(?evolve at GAGeneticAlgorithm@@UAEXI at Z)
ex1.obj : error LNK2019: unresolved external symbol "public: int  
__thiscall GAParameterList::set(char const *,void const *)"  
(?set at GAParameterList@@QAEHPBDPBX at Z) referenced in function "public:  
int __thiscall GAParameterList::set(char const *,unsigned int)"  
(?set at GAParameterList@@QAEHPBDI at Z)
ex1.obj : error LNK2019: unresolved external symbol "public: int  
__thiscall GAParameterList::set(char const *,double)"  
(?set at GAParameterList@@QAEHPBDN at Z) referenced in function "public:  
float __thiscall GAGeneticAlgorithm::pCrossover(float)"  
(?pCrossover at GAGeneticAlgorithm@@QAEMM at Z)
C:\galib247\projects\vcpp2010\Debug\ex1.exe : fatal error LNK1120: 10  
unresolved externals
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I have to mention that the same configuration in Windows Vista gave  
error LNK2001 insted of error LNK2019.
Also, for example 1 I set Project Properties > Linker > Input > Ignore  
specific library to MSVCRTD.lib;msvcprtd.lib.

Any ideas how to build the examples properly?
I read some previous posts about LNK2001 and LNK2019, but they didn't  
helped a lot.
Thank you in advance,
Kyriakos.

-- 
Vafiadis S. Kyriakos
Mechanical Engineer, PhD candidate
University of Western Macedonia
Department of Mechanical Engineering
Tel: +302461056703 (lab)
      +302461029521 (home)
      +306975549089 (mobile)




More information about the galib mailing list