compiling glaurung questions

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

compiling glaurung questions

Postby Uri Blass » 15 Jul 2006, 10:45

1)When I try simply to compile a project from glaurung.h and
empty main.cpp that only has return 0 I get compilation warning and errors.

I can fix the problem simply by changing the lines with long long to int64 and deleting max and min that are not needed but my question is why the code of glaurung is not compatible with microsoft visual C++6?

The code is not only for linux but also for windows so I expected it to work.

typedef __int64 int64;
typedef unsigned __int64 uint64;


c:\glaurung\glaurung.h(246) : warning C4005: 'max' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\windef.h(177) : see previous definition of 'max'
c:\glaurung\glaurung.h(247) : warning C4005: 'min' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\windef.h(181) : see previous definition of 'min'
c:\glaurung\glaurung.h(302) : error C2632: 'long' followed by 'long' is illegal
c:\glaurung\glaurung.h(303) : error C2632: 'long' followed by 'long' is illegal
Error executing cl.exe.

main.obj - 2 error(s), 2 warning(s)


2)I made a new project with all the glaurung cpp files when only glaurung.h was changed not include min and max functions that are not needed when long long was replaced by __int64

I still get the following errors and warning and my question is how can I fix them.

Do I need a different compiler or maybe it is possible to make glaurung compatible to visuall C++6 by adding some
#if defined(C6) when I only need to add #define C6 to the code to make the code work?


Compiling...
book.cpp
d:\engines\glaurung12-src\src\book.cpp(15) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(15) : error C2146: syntax error : missing ')' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(15) : error C2059: syntax error : ')'
d:\engines\glaurung12-src\src\book.cpp(31) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(31) : error C2146: syntax error : missing ';' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(31) : error C2065: 'L' : undeclared identifier
d:\engines\glaurung12-src\src\book.cpp(33) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(33) : error C2146: syntax error : missing ';' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(64) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(64) : error C2146: syntax error : missing ';' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(69) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(69) : error C2146: syntax error : missing ';' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(79) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(79) : error C2146: syntax error : missing ';' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(86) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(86) : error C2146: syntax error : missing ';' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(89) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(89) : warning C4244: '=' : conversion from 'unsigned __int64' to 'int', possible loss of data
d:\engines\glaurung12-src\src\book.cpp(89) : error C2146: syntax error : missing ';' before identifier 'L'
data.cpp
endgame.cpp
eval.cpp
D:\engines\glaurung12-src\src\eval.cpp(54) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
D:\engines\glaurung12-src\src\eval.cpp(55) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\eval.cpp(55) : error C2146: syntax error : missing ')' before identifier 'L'
D:\engines\glaurung12-src\src\eval.cpp(55) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\eval.cpp(55) : error C2059: syntax error : ')'
D:\engines\glaurung12-src\src\eval.cpp(55) : error C2143: syntax error : missing ';' before '{'
D:\engines\glaurung12-src\src\eval.cpp(68) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
D:\engines\glaurung12-src\src\eval.cpp(70) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\eval.cpp(70) : error C2146: syntax error : missing ')' before identifier 'L'
D:\engines\glaurung12-src\src\eval.cpp(70) : error C2059: syntax error : ')'
extend.cpp
init.cpp
io.cpp
D:\engines\glaurung12-src\src\io.cpp(49) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\io.cpp(49) : error C2146: syntax error : missing ')' before identifier 'L'
D:\engines\glaurung12-src\src\io.cpp(49) : error C2059: syntax error : ')'
learn.cpp
D:\engines\glaurung12-src\src\learn.cpp(47) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
D:\engines\glaurung12-src\src\learn.cpp(63) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
D:\engines\glaurung12-src\src\learn.cpp(76) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
main.cpp
mersenne.cpp
move.cpp
movegen.cpp
order.cpp
position.cpp
psq.cpp
pstruct.cpp
D:\engines\glaurung12-src\src\pstruct.cpp(91) : warning C4800: 'unsigned char' : forcing value to bool 'true' or 'false' (performance warning)
D:\engines\glaurung12-src\src\pstruct.cpp(102) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
root.cpp
D:\engines\glaurung12-src\src\root.cpp(92) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\root.cpp(92) : error C2146: syntax error : missing ';' before identifier 'L'
D:\engines\glaurung12-src\src\root.cpp(92) : error C2065: 'L' : undeclared identifier
safety.cpp
search.cpp
D:\engines\glaurung12-src\src\search.cpp(56) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\search.cpp(56) : error C2146: syntax error : missing ')' before identifier 'L'
D:\engines\glaurung12-src\src\search.cpp(56) : error C2059: syntax error : ')'
see.cpp
smp.cpp
strcase.cpp
think.cpp
timeoday.cpp
tt.cpp
uci.cpp
ucioption.cpp
zobrist.cpp
D:\engines\glaurung12-src\src\zobrist.cpp(11) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\zobrist.cpp(11) : error C2146: syntax error : missing ';' before identifier 'L'
D:\engines\glaurung12-src\src\zobrist.cpp(11) : error C2065: 'L' : undeclared identifier
D:\engines\glaurung12-src\src\zobrist.cpp(18) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\zobrist.cpp(18) : error C2146: syntax error : missing ';' before identifier 'L'
D:\engines\glaurung12-src\src\zobrist.cpp(30) : error C2059: syntax error : 'bad suffix on number'
D:\engines\glaurung12-src\src\zobrist.cpp(30) : error C2146: syntax error : missing ';' before identifier 'L'
Error executing cl.exe.

glaurung12.exe - 42 error(s), 8 warning(s)
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: compiling glaurung questions

Postby Bo Persson » 15 Jul 2006, 11:06

Uri Blass wrote:1)When I try simply to compile a project from glaurung.h and
empty main.cpp that only has return 0 I get compilation warning and errors.

I can fix the problem simply by changing the lines with long long to int64 and deleting max and min that are not needed but my question is why the code of glaurung is not compatible with microsoft visual C++6?


Visual C++ 6 is an ancient compiler. Model year is 1998 - previous millennium.

Uri Blass wrote:The code is not only for linux but also for windows so I expected it to work.

typedef __int64 int64;
typedef unsigned __int64 uint64;



2)I made a new project with all the glaurung cpp files when only glaurung.h was changed not include min and max functions that are not needed when long long was replaced by __int64

I still get the following errors and warning and my question is how can I fix them.

Do I need a different compiler or maybe it is possible to make glaurung compatible to visuall C++6 by adding some
#if defined(C6) when I only need to add #define C6 to the code to make the code work?


Compiling...
book.cpp
d:\engines\glaurung12-src\src\book.cpp(15) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(15) : error C2146: syntax error : missing ')' before identifier 'L'



This probably has to do with the long long type, again. The numbers probably have an LL suffix to make them long long. VC6 doesn't know about that. To match the __int64 type, the suffix should be i64, or ui64 if unsigned.
Bo Persson
 
Posts: 5
Joined: 04 Aug 2005, 09:37
Location: Malmö, Sweden

Re: compiling glaurung questions

Postby Tord Romstad » 15 Jul 2006, 11:10

Uri Blass wrote:1)When I try simply to compile a project from glaurung.h and
empty main.cpp that only has return 0 I get compilation warning and errors.

I can fix the problem simply by changing the lines with long long to int64 and deleting max and min that are not needed but my question is why the code of glaurung is not compatible with microsoft visual C++6?

The code is not only for linux but also for windows so I expected it to work.


I think it does compile without changes with the most recent version of the Microsoft compiler - I suppose version 6 is an older one. As far as I know, "long long" for 64-bit integers is actually required by the current C language standard. Your compiler probably implements an older C standard.

typedef __int64 int64;
typedef unsigned __int64 uint64;


I could probably handle these with a few additional "#if defined" directives in glaurung.h. Perhaps I will do so in the future, but I really hate cluttering my code with lots of conditional compilation ...

c:\glaurung\glaurung.h(246) : warning C4005: 'max' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\windef.h(177) : see previous definition of 'max'
c:\glaurung\glaurung.h(247) : warning C4005: 'min' : macro redefinition
c:\program files\microsoft visual studio\vc98\include\windef.h(181) : see previous definition of 'min'


Yes, some systems seem to have "max" and "min" predefined. I think I will simply rename them to "Max" and "Min" in the next version. This should solve this particular problem.

Most of your remaining error messages are of the following type:

d:\engines\glaurung12-src\src\book.cpp(15) : error C2059: syntax error : 'bad suffix on number'
d:\engines\glaurung12-src\src\book.cpp(15) : error C2146: syntax error : missing ')' before identifier 'L'
d:\engines\glaurung12-src\src\book.cpp(15) : error C2059: syntax error : ')'

I think these are caused by your compiler not understanding the "ULL" suffix for unsigned 64-bit ints (which is also a recent addition to the C standard, I think). Perhaps you can solve the problem simply by removing "ULL" everywhere.

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: compiling glaurung questions

Postby Uri Blass » 15 Jul 2006, 16:43

I see that you are right

Now I get only warning and no errors and I do not know if the errors are significant.


Compiling...
book.cpp
d:\engines\glaurung12-src\src\book.cpp(94) : warning C4244: '=' : conversion from 'unsigned __int64' to 'int', possible loss of data
data.cpp
endgame.cpp
eval.cpp
D:\ENGINES\GLAURUNG12-SRC\SRC\eval.cpp(55) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
D:\ENGINES\GLAURUNG12-SRC\SRC\eval.cpp(69) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
extend.cpp
init.cpp
io.cpp
learn.cpp
D:\ENGINES\GLAURUNG12-SRC\SRC\learn.cpp(47) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
D:\ENGINES\GLAURUNG12-SRC\SRC\learn.cpp(63) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
D:\ENGINES\GLAURUNG12-SRC\SRC\learn.cpp(76) : warning C4244: 'initializing' : conversion from 'unsigned __int64' to 'int', possible loss of data
main.cpp
mersenne.cpp
move.cpp
movegen.cpp
order.cpp
position.cpp
psq.cpp
pstruct.cpp
D:\ENGINES\GLAURUNG12-SRC\SRC\pstruct.cpp(91) : warning C4800: 'unsigned char' : forcing value to bool 'true' or 'false' (performance warning)
D:\ENGINES\GLAURUNG12-SRC\SRC\pstruct.cpp(102) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
root.cpp
safety.cpp
search.cpp
see.cpp
smp.cpp
strcase.cpp
think.cpp
timeoday.cpp
tt.cpp
uci.cpp
ucioption.cpp
zobrist.cpp
Linking...

glaurung12.exe - 0 error(s), 8 warning(s)
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 39 guests