I'm very impressed with Daydreamer. In games against it, it's beating me about 93% of the time
I'd like to be able to make my own builds so I can experiment, but it doesn't seem to want to compile under Visual Studio. It doesn't recognize the "bool" type. My guess is because all the code is in extern "C" { } sections, but removing didn't seem to help. Everything in the documentation seems to indicate that "bool" is built-in; can't find anything in project options. Also defining bool myself didn't seem to be legal...
Anyone know how to compile Daydreamer in Visual C++ (using Visual Studio 2010 RC at the moment- maybe should try older version).
Compiling Daydreamer in Visual Studio
Moderators: hgm, Rebel, chrisw
-
- Posts: 388
- Joined: Sun Dec 21, 2008 6:57 pm
- Location: Washington, DC
-
- Posts: 12538
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Compiling Daydreamer in Visual Studio
Daydreamer requires a C99 compiler, which VC++ is not.Greg Strong wrote:I'm very impressed with Daydreamer. In games against it, it's beating me about 93% of the time
I'd like to be able to make my own builds so I can experiment, but it doesn't seem to want to compile under Visual Studio. It doesn't recognize the "bool" type. My guess is because all the code is in extern "C" { } sections, but removing didn't seem to help. Everything in the documentation seems to indicate that "bool" is built-in; can't find anything in project options. Also defining bool myself didn't seem to be legal...
Anyone know how to compile Daydreamer in Visual C++ (using Visual Studio 2010 RC at the moment- maybe should try older version).
You have no shot to compile it with VC++ without doing a big conversion.
It is not just the data types, but also variable scopes, const rules, variant arrays and other things that simply are not allowed in C90.
You can build it with the GCC tool chain.
I was able to successfully build a 64 bit version using MINGW (64 bit version).
-
- Posts: 12538
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Compiling Daydreamer in Visual Studio
Here is my build {has source and binaries} (you have to do a few little tweaky things to get it to work):Dann Corbit wrote:Daydreamer requires a C99 compiler, which VC++ is not.Greg Strong wrote:I'm very impressed with Daydreamer. In games against it, it's beating me about 93% of the time
I'd like to be able to make my own builds so I can experiment, but it doesn't seem to want to compile under Visual Studio. It doesn't recognize the "bool" type. My guess is because all the code is in extern "C" { } sections, but removing didn't seem to help. Everything in the documentation seems to indicate that "bool" is built-in; can't find anything in project options. Also defining bool myself didn't seem to be legal...
Anyone know how to compile Daydreamer in Visual C++ (using Visual Studio 2010 RC at the moment- maybe should try older version).
You have no shot to compile it with VC++ without doing a big conversion.
It is not just the data types, but also variable scopes, const rules, variant arrays and other things that simply are not allowed in C90.
You can build it with the GCC tool chain.
I was able to successfully build a 64 bit version using MINGW (64 bit version).
http://cap.connx.com/chess-engines/new- ... dreamer.7z
-
- Posts: 388
- Joined: Sun Dec 21, 2008 6:57 pm
- Location: Washington, DC
Re: Compiling Daydreamer in Visual Studio
Ok, thanks. I'll give it a quick try, but won't spend much time with it. Didn't realise that C code was not compatable with C++ anymore. (Can't remember the last time I tried to compile something in straight C.)Dann Corbit wrote:Here is my build {has source and binaries} (you have to do a few little tweaky things to get it to work):Dann Corbit wrote:Daydreamer requires a C99 compiler, which VC++ is not.Greg Strong wrote:I'm very impressed with Daydreamer. In games against it, it's beating me about 93% of the time
I'd like to be able to make my own builds so I can experiment, but it doesn't seem to want to compile under Visual Studio. It doesn't recognize the "bool" type. My guess is because all the code is in extern "C" { } sections, but removing didn't seem to help. Everything in the documentation seems to indicate that "bool" is built-in; can't find anything in project options. Also defining bool myself didn't seem to be legal...
Anyone know how to compile Daydreamer in Visual C++ (using Visual Studio 2010 RC at the moment- maybe should try older version).
You have no shot to compile it with VC++ without doing a big conversion.
It is not just the data types, but also variable scopes, const rules, variant arrays and other things that simply are not allowed in C90.
You can build it with the GCC tool chain.
I was able to successfully build a 64 bit version using MINGW (64 bit version).
http://cap.connx.com/chess-engines/new- ... dreamer.7z
-
- Posts: 292
- Joined: Tue Jul 07, 2009 4:56 am
Re: Compiling Daydreamer in Visual Studio
Unfortunately some of the rules about types have diverged between C and C++, which, as Dann said, stops it from working with C++ compilers (there are a few other issues, but that's the biggest thing). I've thought about converting it to compile cleanly with a C++ compiler, but it hasn't ever made it to the top of my priority queue.Greg Strong wrote:Ok, thanks. I'll give it a quick try, but won't spend much time with it. Didn't realise that C code was not compatable with C++ anymore. (Can't remember the last time I tried to compile something in straight C.)Dann Corbit wrote:Here is my build {has source and binaries} (you have to do a few little tweaky things to get it to work):Dann Corbit wrote:Daydreamer requires a C99 compiler, which VC++ is not.Greg Strong wrote:I'm very impressed with Daydreamer. In games against it, it's beating me about 93% of the time
I'd like to be able to make my own builds so I can experiment, but it doesn't seem to want to compile under Visual Studio. It doesn't recognize the "bool" type. My guess is because all the code is in extern "C" { } sections, but removing didn't seem to help. Everything in the documentation seems to indicate that "bool" is built-in; can't find anything in project options. Also defining bool myself didn't seem to be legal...
Anyone know how to compile Daydreamer in Visual C++ (using Visual Studio 2010 RC at the moment- maybe should try older version).
You have no shot to compile it with VC++ without doing a big conversion.
It is not just the data types, but also variable scopes, const rules, variant arrays and other things that simply are not allowed in C90.
You can build it with the GCC tool chain.
I was able to successfully build a 64 bit version using MINGW (64 bit version).
http://cap.connx.com/chess-engines/new- ... dreamer.7z
In any case, I'm happy that daydreamer got your attention. If you have any questions about it I'd be happy to discuss, and if you do happen to get it compiling and do some experiments, I'd love to hear what you learn.
-
- Posts: 388
- Joined: Wed Mar 08, 2006 10:08 pm
Re: Compiling Daydreamer in Visual Studio
It isn't big. It does not even involve a "conversion".Dann Corbit wrote: You have no shot to compile it with VC++ without doing a big conversion.
1. cast all calls to malloc() with the target type. there is just 3 or 4 of these.
2. wrap with #ifndef _MSC_VER (or remove) the line #include <strings.h>
3. in compatibility.h, add the following lines under the _MSC_VER section:
typedef __int64 int64_t;
#define PRIu64 "%I64u"
#define PRIx64 "%I64x"
#define INT32_MAX INT_MAX
#define INT64_MAX _I64_MAX
#include <time.h>
int gettimeofday(struct timeval *tv, struct timezone *tz){clock_t c=clock();tv->tv_sec=c/1000;tv->tv_usec=(c%1000)*1000;return 0;}
#define snprintf _snprintf
4. in eval_pieces.c, define 'file_t file' and 'int rrank' at the start of the function instead of before its use.
5. in hash.c, add "={}" to the declaration of piece_random, castle_random and enpassant_random
that's it! now compile "as C++" (-TP option).
cl -Oxt -W0 -TP *.c
btw, the gettimeofday above is not correct. the engine is not looking for the time of day anyway - but just some timer. so, that is what is provided here in a compact form.
-
- Posts: 388
- Joined: Sun Dec 21, 2008 6:57 pm
- Location: Washington, DC
Re: Compiling Daydreamer in Visual Studio
What version of VC++ does this work with? Asking because it doesn't look this will address the fact that it doesn't recognize "bool" (and won't let me define it.)CThinker wrote:It isn't big. It does not even involve a "conversion".Dann Corbit wrote: You have no shot to compile it with VC++ without doing a big conversion.
1. cast all calls to malloc() with the target type. there is just 3 or 4 of these.
2. wrap with #ifndef _MSC_VER (or remove) the line #include <strings.h>
3. in compatibility.h, add the following lines under the _MSC_VER section:
typedef __int64 int64_t;
#define PRIu64 "%I64u"
#define PRIx64 "%I64x"
#define INT32_MAX INT_MAX
#define INT64_MAX _I64_MAX
#include <time.h>
int gettimeofday(struct timeval *tv, struct timezone *tz){clock_t c=clock();tv->tv_sec=c/1000;tv->tv_usec=(c%1000)*1000;return 0;}
#define snprintf _snprintf
4. in eval_pieces.c, define 'file_t file' and 'int rrank' at the start of the function instead of before its use.
5. in hash.c, add "={}" to the declaration of piece_random, castle_random and enpassant_random
that's it! now compile "as C++" (-TP option).
cl -Oxt -W0 -TP *.c
btw, the gettimeofday above is not correct. the engine is not looking for the time of day anyway - but just some timer. so, that is what is provided here in a compact form.
-
- Posts: 388
- Joined: Wed Mar 08, 2006 10:08 pm
Re: Compiling Daydreamer in Visual Studio
It works with PSDKs (VC7, VC8,VC9), and VC10 (VS 2010 RC).Greg Strong wrote:What version of VC++ does this work with? Asking because it doesn't look this will address the fact that it doesn't recognize "bool" (and won't let me define it.)CThinker wrote:It isn't big. It does not even involve a "conversion".Dann Corbit wrote: You have no shot to compile it with VC++ without doing a big conversion.
1. cast all calls to malloc() with the target type. there is just 3 or 4 of these.
2. wrap with #ifndef _MSC_VER (or remove) the line #include <strings.h>
3. in compatibility.h, add the following lines under the _MSC_VER section:
typedef __int64 int64_t;
#define PRIu64 "%I64u"
#define PRIx64 "%I64x"
#define INT32_MAX INT_MAX
#define INT64_MAX _I64_MAX
#include <time.h>
int gettimeofday(struct timeval *tv, struct timezone *tz){clock_t c=clock();tv->tv_sec=c/1000;tv->tv_usec=(c%1000)*1000;return 0;}
#define snprintf _snprintf
4. in eval_pieces.c, define 'file_t file' and 'int rrank' at the start of the function instead of before its use.
5. in hash.c, add "={}" to the declaration of piece_random, castle_random and enpassant_random
that's it! now compile "as C++" (-TP option).
cl -Oxt -W0 -TP *.c
btw, the gettimeofday above is not correct. the engine is not looking for the time of day anyway - but just some timer. so, that is what is provided here in a compact form.
The reason why you can't get 'bool' to work is that you are trying to compile "as C". You should compile "as C++", using the "-TP" option.
-
- Posts: 388
- Joined: Wed Mar 08, 2006 10:08 pm
Re: Compiling Daydreamer in Visual Studio
Oh, I forgot one more thing...CThinker wrote:It works with PSDKs (VC7, VC8,VC9), and VC10 (VS 2010 RC).Greg Strong wrote:What version of VC++ does this work with? Asking because it doesn't look this will address the fact that it doesn't recognize "bool" (and won't let me define it.)CThinker wrote:It isn't big. It does not even involve a "conversion".Dann Corbit wrote: You have no shot to compile it with VC++ without doing a big conversion.
1. cast all calls to malloc() with the target type. there is just 3 or 4 of these.
2. wrap with #ifndef _MSC_VER (or remove) the line #include <strings.h>
3. in compatibility.h, add the following lines under the _MSC_VER section:
typedef __int64 int64_t;
#define PRIu64 "%I64u"
#define PRIx64 "%I64x"
#define INT32_MAX INT_MAX
#define INT64_MAX _I64_MAX
#include <time.h>
int gettimeofday(struct timeval *tv, struct timezone *tz){clock_t c=clock();tv->tv_sec=c/1000;tv->tv_usec=(c%1000)*1000;return 0;}
#define snprintf _snprintf
4. in eval_pieces.c, define 'file_t file' and 'int rrank' at the start of the function instead of before its use.
5. in hash.c, add "={}" to the declaration of piece_random, castle_random and enpassant_random
that's it! now compile "as C++" (-TP option).
cl -Oxt -W0 -TP *.c
btw, the gettimeofday above is not correct. the engine is not looking for the time of day anyway - but just some timer. so, that is what is provided here in a compact form.
The reason why you can't get 'bool' to work is that you are trying to compile "as C". You should compile "as C++", using the "-TP" option.
This engine has code that does arithmetic operations on enum types. To get around that, you do this:
Replace enum definitions that looks like:
typedef enum { E1, E2 } my_t;
with:
enum { E1, E2 };
typedef int my_t;
-
- Posts: 12538
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Compiling Daydreamer in Visual Studio
Did you actually try it?CThinker wrote:Oh, I forgot one more thing...CThinker wrote:It works with PSDKs (VC7, VC8,VC9), and VC10 (VS 2010 RC).Greg Strong wrote:This assumes that CLOCKS_PER_SEC is 1000. It probably is on most MS compilers, but CLOCKS_PER_SEC will have the right value and be more portable.CThinker wrote:It isn't big. It does not even involve a "conversion".Dann Corbit wrote: You have no shot to compile it with VC++ without doing a big conversion.
1. cast all calls to malloc() with the target type. there is just 3 or 4 of these.
2. wrap with #ifndef _MSC_VER (or remove) the line #include <strings.h>
3. in compatibility.h, add the following lines under the _MSC_VER section:
typedef __int64 int64_t;
#define PRIu64 "%I64u"
#define PRIx64 "%I64x"
#define INT32_MAX INT_MAX
#define INT64_MAX _I64_MAX
#include <time.h>
int gettimeofday(struct timeval *tv, struct timezone *tz){clock_t c=clock();tv->tv_sec=c/1000;tv->tv_usec=(c%1000)*1000;return 0;}What version of VC++ does this work with? Asking because it doesn't look this will address the fact that it doesn't recognize "bool" (and won't let me define it.)#define snprintf _snprintf
4. in eval_pieces.c, define 'file_t file' and 'int rrank' at the start of the function instead of before its use.
5. in hash.c, add "={}" to the declaration of piece_random, castle_random and enpassant_random
that's it! now compile "as C++" (-TP option).
cl -Oxt -W0 -TP *.c
btw, the gettimeofday above is not correct. the engine is not looking for the time of day anyway - but just some timer. so, that is what is provided here in a compact form.
The reason why you can't get 'bool' to work is that you are trying to compile "as C". You should compile "as C++", using the "-TP" option.
This engine has code that does arithmetic operations on enum types. To get around that, you do this:
Replace enum definitions that looks like:
typedef enum { E1, E2 } my_t;
with:
enum { E1, E2 };
typedef int my_t;
I get thousands of compilation errors due to variables declared after the execution of a statement and other things like that.