[gecode-users] Version 3.x.x and Microsoft Visual C++ 2005Express Edition

David Rijsman David.Rijsman at quintiq.com
Thu Sep 3 15:30:41 CEST 2009


Hi Christian,

I quote from msdn "Certain functions that depend on a particular version of Windows are declared using conditional code. This enables you to use the compiler to detect whether your application uses functions that are not supported on its target version(s) of Windows. To compile an application that uses these functions, you must define the appropriate macros." 

The error we receive without the macro is:

.\gecode/support/thread/windows.hpp(77) : error C3861: 'TryEnterCriticalSection': identifier not found

Old versions of Windows (before NT 4.0) did not support the system call TryEnterCriticalSection on CriticalSection objects. A default Visual C++ build is compatible with old Windows releases, so it does not provide TryEnterCriticalSection. Defining _WIN32_WINNT to 0x0400 (or greater) solves this problem. 


David

>>> 
From: 	"Christian Schulte" <cschulte at kth.se>
To:	"'David Rijsman'" <David.Rijsman at quintiq.com>, <users at gecode.org>
Date: 	9/3/2009 3:18 PM
Subject: 	Re: [gecode-users] Version 3.x.x and Microsoft Visual C++ 2005Express	Edition

Hi David,

Sure! I'll add that! Can you enlighten me what this magic incantation does?

All the best
Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/ 

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of David Rijsman
Sent: Thursday, September 03, 2009 3:03 PM
To: users at gecode.org 
Subject: [gecode-users] Version 3.x.x and Microsoft Visual C++ 2005 Express
Edition

Hi,

I noticed that version 3.0.x no longer supports the Microsoft Visual C++
2005 Express Edition and indeed the code does not compile using this
compiler. Although the Microsoft Visual C++ 2008 Express Edition is free it
is no option for me to use this one. 


I also noticed it is pretty easy to get the code compiling, running and
passing al the tests again using the Microsoft Visual C++ 2005 Express
Edition. All one has to do is change in "thread.hh"

#ifdef GECODE_THREADS_WINDOWS
#include <windows.h>
#endif

into

#ifdef GECODE_THREADS_WINDOWS

#ifndef _WIN32_WINNT
#   define _WIN32_WINNT 0x400
#endif

#include <windows.h>
#endif

this works for 32 bits and 64 bits machine. Perhaps this can be added in the
next releases?

thanks,








David J Rijsman
Algorithm Lead
Quintiq
 
T +31 (0)73 691 07 39
F +31 (0)73 691 07 54
M +31 (0)62 127 68 29
E david.rijsman at quintiq.nl 
I www.quintiq.com 



_______________________________________________
Gecode users mailing list
users at gecode.org 
https://www.gecode.org/mailman/listinfo/gecode-users 


_______________________________________________
Gecode users mailing list
users at gecode.org 
https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list