[gecode-users] Linking to Gecode with Microsoft Visual C++

Filip Konvička filip.konvicka at logis.cz
Tue Sep 2 17:10:50 CEST 2008


Hi,

> We had a bit of trouble trying to link to the binary Gecode  
> distribution from a Microsoft Visual Studio C++ project.  First of  
> all, here's what you have to set up in the properties dialog of your  
> "Solution":
>   * Configuration Properties, C++, General, set the Additional Include  
> Directories to <Program Files>\Gecode
>   * Configuration Properties, Linker, General, set the Additional  
> Library Directories to <Program Files>\Gecode\lib
>   * Configuration Properties, Linker, Input, set the Additional  
> Dependencies to GecodeSupport.lib GecodeKernel.lib GecodeSearch.lib  
> etc. (all the Gecode libraries that you want to link against)

I've always used Gecode like this (since 1.3.0 I think) and I never had 
any problems.

> That should do the trick, except that only a release build works  
> properly at the moment.  If you build your project using a Debug  
> configuration instead, your program will crash with "bad alloc" errors.

That does not happen for us. We're using the same 'non-debug' Gecode 
binaries for all project configurations, i.e. 'Release', 
'ReleaseWithDebugInfo', 'Debug'. That includes different /MD, /MDd (and 
more).

If it is not too complicated, could you post (or just mail me) a sample 
project that shows the problems?

> Apparently, inlining doesn't work too well when linking against  
> different libraries (i.e., linking Gecode with /MD while linking your  
> program with /MDd).  So, for the time being, you will have to compile  
> your program as a Release build, or compile your own version of Gecode  
> with debug turned on.  We're looking into this issue, and we'll try to  
> produce (optimized) libraries that can be used in a Debug build for  
> the next version of Gecode.

Hm...we use Debug mode often and we're able to step into all code that 
is not hidden in Gecode dlls. For 2.2.0, we build Gecode just using 
"./configure --disable-examples", "make install", so no special flags. 
So I guess we're very close to the official binary package.

Maybe there are some binary compatibility issues between different 
versions of MSVC?

Cheers,
Filip





More information about the gecode-users mailing list