[galib] Error during compilation in MSVC++ 2010

mmj10@aber.ac.uk mmj10 at aber.ac.uk
Tue Dec 14 05:43:30 EST 2010


I don't think I have ever received LNK2005 errors but I did finally get
GAlib working for me, this is what I did...

So far with MSVC, you have done it correctly, but in the additional .h
files and .c files make sure the #includes do not look like this
<ga/GA1DBinStrGenome.h>, since you have now set the additional include
directory path you do not need the word "ga/", make sure the #includes
look like this - "GA1DBinStrGenome.h" NOT <GA1DBinStrGenome.h>, any
include with a *.h at the end, put quotation marks " around them, if there
is no *.h, put the square brackets <> around them.

When you compile them, compile it in BOTH release and debug, for debugging
in MSVC, rename the ga.lib file created using debug mode to something like
gadb.lib.

Oh one more point, it seems (from my experience) that you cannot compile
galib with one compiler and use it in another, I found this out when I was
going to create galib for my project in September but got sidetracked till
now when I use to use MSVC 2008, then I decided to upgrade to MSVC 2010,
ga.lib it would not work (came up with LNK2001 and 2019 errors) - it was
only by chance that I decided to recompile galib in MSVC 2010.

When using ga.lib in your own project, (again from experience), go to
properties -> linker -> command line, in the additional options box put
/FORCE:MULTIPLE to ignore clashing symbols from ga.lib with other default
libs from MSVC

Hope this helps


> Hi:
>
> I downloaded GALib version 247. I compiled as documented, using the
> following command
>
> nmake /f makefile.vcpp
>
> I got ga.lib.
>
> I am now trying to create a vc++ project, referencing ga.lib. In my MSVC
> ide
> I have set the following.
>
> C/C++ -> General -> Additional Include Directories = path to where the
> header files reside
> Linker -> Input -> Additional Dependencies = ga.lib
> Linker -> General -> Additional Library Directories = path to where the
> ga.lib resides
>
> I created a vc++ solution based on ex1, when I am compiling I am getting a
> lot of linker errors. Primarily, the error output mentions msvcprtd.lib
> and
> libcmtd.lib
>
> Error Output:
> 1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: class
> std::basic_ostream<char,struct std::char_traits<char> > & __thiscall
> std::basic_ostream<char,struct std::char_traits<char> >::flush(void)"
> (?flush@?$basic_ostream at DU?$char_traits at D@std@@@std@@QAEAAV12 at XZ) already
> defined in ga.lib(GA2DBinStrGenome.o)
> 1>LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already
> defined in MSVCRTD.lib(MSVCR100D.dll)
>
> My OS is Windows Pro 7, x86_64.
>
> I would really appreciate if someone can help me in compiling the examples
> in MSVC++ ide.
>
> --
> Regards,
> Arup
> _______________________________________________
> galib mailing list
> galib at mit.edu
> http://mailman.mit.edu/mailman/listinfo/galib
>




More information about the galib mailing list