Answers to Building GALib in Visual C++

Kyle and Liz kyle_liz at
Tue May 22 00:44:08 EDT 2001


I see that someone has already helped you, but I thought I'd share my experience with you as well in case it covers something you're missing.  I have attached an email that provides a lengthy, but detailed, exchange of questions and answers I had sent to someone else that was trying to build the GALib in Visual C++.  Take the time to read through the progression of the responses and it should help you out.  Good luck.
Kyle Franzen
Omaha, Nebraska

-----Original Message-----
From:	khaled shawki [SMTP:kshawki at]
Sent:	Thursday, May 17, 2001 3:27 PM
To:	galib at
Subject:	Unidentified subject!

 << File: ATT00004.txt; charset = windows-1256 >>  << File: ATT00005.htm; charset = windows-1256 >> 
-------------- next part --------------

OK, it's been a while like I said.  I'll try harder this time.

--first, i didn't intend for you to use my dsp and dsw files as your actual
project.  make your own new project for the static lib.  i just meant for
you to open the dsp file to see the project settings as an example.

--make your directory structure like this for your static lib project:  make
a directory called "ga"(or just use the ga dir that is there) and then under
that make the directory for whatever you call your new static lib project.
this is important b/c all the includes in the headers and cpp files
reference one directory higher called "ga"  like this:  #include

--now make your static lib project and target it in the directory below the
ga dir.

--now when you insert the galib245 files into your newly made project inside
devstudio, do it from the 'File View'.  then right-click on the 'Header
Files' directory and choose "Add Files to Folder...",  then you need to
navigate to the include the *.h files from the ga dir.

--do the same thing for the source, *.c, files.  right-click on the 'Source
Files' and add files again...

--next in devstudio, go to the menu, Project->Options->Directories tab, then
select 'Show directories for:' > Include files <.  then enter the path where
all the header files are for the galib245, the path to your ga dir so your
new static lib project knows where to find them.

--I don't think i defined the NO_STREAMS setting in the gaconfig.h
file ------ i take that back, b/c i don't set anything, it is set to define
NO_STREAMS already it looks like.  look in gaconfig.h to satisfy yourself.

--go to the menu, Project->Settings->C/C++ tab and make sure you put in the
/TP flag "manually" into the bottom right dialog window where all the other
compiler flags/settings are, and do it for both debug and release.  make
sure not to change anything else in there!!

--now, while still in the C/C++ tab, select "C++ Language" from the
'Category' drop-down list at the top of the tab.  you should now see an
'Enable Run Time Type Information' option.  make sure that it is checked on
for both debug and release modes.

--that should get you pretty close.

--here is something i wanted to make sure you read if it applies to you.
this is from the 'Installation Instructions for GALib' html page.
Do not explicitly compile GARealGenome.C or GAStringGenome.C! These are
specializations of template classes and should be included once (and only
once) in one of your source files. If you are using a real number genome,
include GARealGenome.h in any file that refers to a real number genome and
include GARealGenome.C in one (and only one) location in your code.
GARealGenome.C contains a specialization of the one-dimensional array class,
so by including it in a single location you will tell the compiler to use
the specialization rather than the generic template code. The string genome
is also a specialization of the one-dimensional array genome, so to use it
you should follow the same guidelines (but include the string genome header
and source rather than the real number genome header and source).

--the only other thing i can think of is that once i built this project as
described above, i got some compiler errors saying certain data types
weren't defined.  so i just had to inlcude the corresponding header files
that contained those definitions into the 'complaining' files and it worked.

--you just have to work at it!

--then as far as the examples go, i got the gademo project from there
website and ran it.  it doesn't really help much, just cool to watch the
points on the graph get closer to optimal visually.

--the separate individual example files are good for deciding which kind of
ga you need to solve your problem!!!  what you need is the documentation
manual which i have attached.  you'll need Adobe Reader to view it and print
MANUAL!!!  b/c when you are trying to implement the galib.lib file that you
build above into your problem specific project you will refer to it MANY
TIMES and to multiple pages at once.  IT IS WAY TOO FRUSTRATING TO DO IT

--just to let you know to best budget your time, however hard you think it
is to just build the galib.lib ga engine, it is likely that it will take you
ten times as long/hard to develop your problems project to utilize the ga.
i have been doing this in my spare time about 8 - 10 hours a week since
august to try to make my scheduling application and i think i'll finish in
about a month.  But then again if you have an easy objective function
already in mind to evaluate the fitness of the strings you just need to plop
that evaluation equation into the global Objective() method of the ga and
you're ready to go.



-----Original Message-----
From: kc_ at <kc_ at>
To: Kyle and Liz <kyle_liz at>
Date: Thursday, November 16, 2000 9:33 AM
Subject: Re: help: how to run galib245 in Visual C++?

>Hi Kyle
>    Thanks for replying to my enquiry and sending the 2 files.  I have
>your suggestion but encountered some problems which I'm unsure how to
>further.  I would sincerely like to ask for any help as I'm rather pressed
>After unzipping the, there will be 3 directories and several
>files.  The directories are :
>1)  Doc
>2)  Ex
>3)  Ga
>I put your 2 files (*.dsp & *.dsw ) into Ga directory and built the static
>library file : galib.lib
>( as you suggested).  Then I place the entire Ga directory into the Include
>directory (where Visual C reads its header files ). This is done because
>other header files use the format :
> < ga\ga****.h>
>I use #define NO_STREAMS in the gaconfig.h ( as suggested by the GAlib
>documentation )
>Then I proceed to open several 'examples' in Ex directory and try to build
>into *.exe.
>I keep getting compiler errors :
>C2872  ........ ambiguous symbol ( for cout & << )
>I would appreciate help on how to address the above.  I would kindly like
to ask
>if a working copy of the galib245 is available that does not require so
>Thank you and regards.

>Kyle and Liz wrote:
>> kenneth,
>> i've done what you're trying to do.  the galib.lib file is missing from
>> zip file you download b/c you have to build it from the files they
>> in the zip.  and there are no *.dsp or *.dsw files either you need to
>> your own.  you'll find that some things they provide it seems like aren't
>> doing a good job of being thorough and precise, but once you get it
>> you see that they have done a heck of a lot of work to write this and
>> support it for so many different platforms.  so, my advice is that if you
>> really want to make this thing run, you need to 'roll up your sleeves'
>> put in the time to make it work.
>> take the time to read through the installation instructions for
>> in the end i did not use the makefile directions, but it helps to
>> understand.  i personally like building inside a workspace and setting
>> settings from the menu Project->Settings dialogs.
>> what i did was just create a new project in devstudio 6.0, by going to
>> File->New->Projects and then selecting 'Win32 Static Library'.  now
>> got your devstudio project and workspace files.  then in that project
>> import(or insert) the files from the galib245 release and you're almost
>> there.  i'm likely missing some things b/c it's been since august when i
>> this, sorry.
>> one thing i do remember is setting the /TP flag.  this flag tells
>> compiler to treat the *.c files as c++ files.  this is very important!!!
>> could not find the setting to check or fill in, in the project settings
>> dialogs.  so, what i did was just put the /TP right in the actual
>> Options' window which is at the bottom right of the 'C/C++' tab of the
>> project settings dialog.  you'll see other flags in there with similar
>> syntax.  make sure to do it for both debug and release modes.
>> then i htink i remember having to include a bunch of the header files
>> another file somewhere to get rid of some massive compiler errors.  but
>> i did that it worked.  i built it for release as galib.lib and am now
>> it to run my ga application.  to set the target output name go to the
>> 'Library' tab of the project settings dialog and enter the desired path
>> then galib.lib.
>> the only other thing i can think of is including some actual source files
>> (*.c) files in some file and somewhere in the documentation that they
>> provide, them saying that it is very important to do this once and only
>> in your entire project.  but that might be for including into your
>> application later - i can't remember.
>> this seems foolish now after all that explanation, but here are my dsp
>> dsw files.  i think you can open them up in devstudio and just take off
>> there by inserting the files and building.  good luck.
>> kyle franzen
>> industrial engineer/software developer
>> omaha, nebraska

More information about the galib mailing list