Closed tissatussa closed 11 months ago
Hi, I will defenitely try to add a makefile on the next release of Mida. The full log would be appreciated :) Also, I found a non-protected inclusion of windows.h in my code, and that is probably what caused the error. I just committed the updated code, and hopefully at least some errors are fixed for now. I'm not an expert on Linux, to be honest, so can I ask you what's the problem with the Board.h/cpp ? Is it the capital B in the name of the file? Thanks
I will defenitely try to add a makefile on the next release of Mida
yes, you can find many versions of makefiles on GitHub (chess engine projects) .. some are very simple, just determine the OS / CPU type and set your g++ / gcc options.
I found a non-protected inclusion of windows.h
great! but i'm not familiar with C(++)
Is it the capital B in the name of the file?
yes, Linux file naming is case sensitive, it's best practice to keep all file names lowercase.
[ full log soon ]
AFAIK to suit Linux and maybe Mac, mainly focus on modern / general variable types, like uint64
or the t_...
ones : it must be possible to write general code which compiles on all major OS ? When i try to fix some Windows (C) code too make it work on Linux, i sometimes succeed only by changing those var types.
here's my full log during compilation with a very basic gcc
command -- first i renamed all files lowercase, also their calls, and commented-out all <windows.h>
lines, that's all.
$ gcc *.cpp -o mida
In file included from board_declaration.h:4,
from bitboard.h:5,
from bitboard.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from board.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from evaluate.h:7,
from board.cpp:3:
nnue.h:102:25: error: expected constructor, destructor, or type conversion before ‘(’ token
102 | DLLExport __declspec(dllexport) void _CDECL nnue_init(
| ^
nnue.h:111:21: error: expected constructor, destructor, or type conversion before ‘(’ token
111 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_fen(
| ^
nnue.h:133:21: error: expected constructor, destructor, or type conversion before ‘(’ token
133 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate(
| ^
nnue.h:150:21: error: expected constructor, destructor, or type conversion before ‘(’ token
150 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_incremental(
| ^
In file included from board_declaration.h:4,
from board_declaration.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:64:5: warning: integer constant is so large that it is unsigned
64 | 11533718717099671552,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:71:5: warning: integer constant is so large that it is unsigned
71 | 9799982666336960512,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:138:5: warning: integer constant is so large that it is unsigned
138 | 16186183351374184448,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:139:5: warning: integer constant is so large that it is unsigned
139 | 13853283560024178688,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:146:5: warning: integer constant is so large that it is unsigned
146 | 11592265440851656704,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:204:5: warning: integer constant is so large that it is unsigned
204 | 11529215046068469760,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:291:5: warning: integer constant is so large that it is unsigned
291 | 9259542123273814144,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:299:5: warning: integer constant is so large that it is unsigned
299 | 9259542123273814144,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:307:5: warning: integer constant is so large that it is unsigned
307 | 9259542123273814144,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:315:5: warning: integer constant is so large that it is unsigned
315 | 9259542123273814144,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:323:5: warning: integer constant is so large that it is unsigned
323 | 9259542123273814144,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:331:5: warning: integer constant is so large that it is unsigned
331 | 9259542123273814144,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:339:5: warning: integer constant is so large that it is unsigned
339 | 9259542123273814144,
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:347:5: warning: integer constant is so large that it is unsigned
347 | 9259542123273814144};
| ^~~~~~~~~~~~~~~~~~~
constants.cpp:406:5: warning: integer constant is so large that it is unsigned
406 | 18374686479671623680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:407:5: warning: integer constant is so large that it is unsigned
407 | 18374686479671623680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:408:5: warning: integer constant is so large that it is unsigned
408 | 18374686479671623680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:409:5: warning: integer constant is so large that it is unsigned
409 | 18374686479671623680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:410:5: warning: integer constant is so large that it is unsigned
410 | 18374686479671623680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:411:5: warning: integer constant is so large that it is unsigned
411 | 18374686479671623680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:412:5: warning: integer constant is so large that it is unsigned
412 | 18374686479671623680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:413:5: warning: integer constant is so large that it is unsigned
413 | 18374686479671623680};
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:443:5: warning: integer constant is so large that it is unsigned
443 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:451:5: warning: integer constant is so large that it is unsigned
451 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:459:5: warning: integer constant is so large that it is unsigned
459 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:467:5: warning: integer constant is so large that it is unsigned
467 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:475:5: warning: integer constant is so large that it is unsigned
475 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:483:5: warning: integer constant is so large that it is unsigned
483 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:491:5: warning: integer constant is so large that it is unsigned
491 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:499:5: warning: integer constant is so large that it is unsigned
499 | 11574427654092267680,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:509:5: warning: integer constant is so large that it is unsigned
509 | 16204198715729174528,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:510:5: warning: integer constant is so large that it is unsigned
510 | 13889313184910721024,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:517:5: warning: integer constant is so large that it is unsigned
517 | 16204198715729117184,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:518:5: warning: integer constant is so large that it is unsigned
518 | 13889313184910671872,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:525:5: warning: integer constant is so large that it is unsigned
525 | 16204198715714437120,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:526:5: warning: integer constant is so large that it is unsigned
526 | 13889313184898088960,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:533:5: warning: integer constant is so large that it is unsigned
533 | 16204198711956340736,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:534:5: warning: integer constant is so large that it is unsigned
534 | 13889313181676863488,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:541:5: warning: integer constant is so large that it is unsigned
541 | 16204197749883666432,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:542:5: warning: integer constant is so large that it is unsigned
542 | 13889312357043142656,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:549:5: warning: integer constant is so large that it is unsigned
549 | 16203951459279044608,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:550:5: warning: integer constant is so large that it is unsigned
550 | 13889101250810609664,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:557:5: warning: integer constant is so large that it is unsigned
557 | 16140901064495857664,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:558:5: warning: integer constant is so large that it is unsigned
558 | 13835058055282163712,
| ^~~~~~~~~~~~~~~~~~~~
constants.cpp:634:35: warning: integer constant is so large that it is unsigned
634 | const uint64_t black_squares_bb = 12273903644374837845;
| ^~~~~~~~~~~~~~~~~~~~
In file included from board_declaration.h:4,
from bitboard.h:5,
from evaluate.h:6,
from evaluate.cpp:2:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from evaluate.h:7,
from evaluate.cpp:2:
nnue.h:102:25: error: expected constructor, destructor, or type conversion before ‘(’ token
102 | DLLExport __declspec(dllexport) void _CDECL nnue_init(
| ^
nnue.h:111:21: error: expected constructor, destructor, or type conversion before ‘(’ token
111 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_fen(
| ^
nnue.h:133:21: error: expected constructor, destructor, or type conversion before ‘(’ token
133 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate(
| ^
nnue.h:150:21: error: expected constructor, destructor, or type conversion before ‘(’ token
150 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_incremental(
| ^
In file included from evaluate.cpp:10:
nnue_eval.h: In function ‘void init_nnue(char*)’:
nnue_eval.h:6:5: error: ‘nnue_init’ was not declared in this scope; did you mean ‘nnue_input’?
6 | nnue_init(filename);
| ^~~~~~~~~
| nnue_input
nnue_eval.h: In function ‘int evaluate_nnue(int, int*, int*, NNUEdata*)’:
nnue_eval.h:10:12: error: ‘nnue_evaluate’ was not declared in this scope; did you mean ‘nnue_evaluate_pos’?
10 | return nnue_evaluate(player, pieces, squares, nn);
| ^~~~~~~~~~~~~
| nnue_evaluate_pos
nnue_eval.h: In function ‘int evaluate_nnue_incremental(int, int*, int*, NNUEdata**)’:
nnue_eval.h:14:12: error: ‘nnue_evaluate_incremental’ was not declared in this scope
14 | return nnue_evaluate_incremental(player, pieces, squares, nn_stack);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
nnue_eval.h: In function ‘int evaluate_fen_nnue(char*)’:
nnue_eval.h:18:12: error: ‘nnue_evaluate_fen’ was not declared in this scope; did you mean ‘nnue_evaluate_pos’?
18 | return nnue_evaluate_fen(fen);
| ^~~~~~~~~~~~~~~~~
| nnue_evaluate_pos
In file included from board_declaration.h:4,
from bitboard.h:5,
from magic_bitboards.h:5,
from hashing.cpp:5:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from board_declaration.h:4,
from bitboard.h:5,
from magic_bitboards.h:5,
from magic_bitboards.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from board_declaration.h:4,
from bitboard.h:5,
from magic_bitboards.h:5,
from main.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from evaluate.h:7,
from search.h:10,
from uci.h:11,
from main.cpp:4:
nnue.h:102:25: error: expected constructor, destructor, or type conversion before ‘(’ token
102 | DLLExport __declspec(dllexport) void _CDECL nnue_init(
| ^
nnue.h:111:21: error: expected constructor, destructor, or type conversion before ‘(’ token
111 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_fen(
| ^
nnue.h:133:21: error: expected constructor, destructor, or type conversion before ‘(’ token
133 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate(
| ^
nnue.h:150:21: error: expected constructor, destructor, or type conversion before ‘(’ token
150 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_incremental(
| ^
In file included from main.cpp:6:
nnue_eval.h: In function ‘void init_nnue(char*)’:
nnue_eval.h:6:5: error: ‘nnue_init’ was not declared in this scope; did you mean ‘nnue_input’?
6 | nnue_init(filename);
| ^~~~~~~~~
| nnue_input
nnue_eval.h: In function ‘int evaluate_nnue(int, int*, int*, NNUEdata*)’:
nnue_eval.h:10:12: error: ‘nnue_evaluate’ was not declared in this scope; did you mean ‘nnue_evaluate_pos’?
10 | return nnue_evaluate(player, pieces, squares, nn);
| ^~~~~~~~~~~~~
| nnue_evaluate_pos
nnue_eval.h: In function ‘int evaluate_nnue_incremental(int, int*, int*, NNUEdata**)’:
nnue_eval.h:14:12: error: ‘nnue_evaluate_incremental’ was not declared in this scope
14 | return nnue_evaluate_incremental(player, pieces, squares, nn_stack);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
nnue_eval.h: In function ‘int evaluate_fen_nnue(char*)’:
nnue_eval.h:18:12: error: ‘nnue_evaluate_fen’ was not declared in this scope; did you mean ‘nnue_evaluate_pos’?
18 | return nnue_evaluate_fen(fen);
| ^~~~~~~~~~~~~~~~~
| nnue_evaluate_pos
main.cpp: In function ‘int main()’:
main.cpp:30:22: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
30 | char *filename = "mida-nn.nnue";
| ^~~~~~~~~~~~~~
In file included from board_declaration.h:4,
from bitboard.h:5,
from make_move.h:7,
from make_move.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from board_declaration.h:4,
from bitboard.h:5,
from move_ordering.h:8,
from move_ordering.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from nnue.cpp:52:
nnue.h:102:25: error: expected constructor, destructor, or type conversion before ‘(’ token
102 | DLLExport __declspec(dllexport) void _CDECL nnue_init(
| ^
nnue.h:111:21: error: expected constructor, destructor, or type conversion before ‘(’ token
111 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_fen(
| ^
nnue.h:133:21: error: expected constructor, destructor, or type conversion before ‘(’ token
133 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate(
| ^
nnue.h:150:21: error: expected constructor, destructor, or type conversion before ‘(’ token
150 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_incremental(
| ^
In file included from board_declaration.h:4,
from perft.cpp:2:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from board_declaration.h:4,
from search.h:9,
from search.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from evaluate.h:7,
from search.h:10,
from search.cpp:1:
nnue.h:102:25: error: expected constructor, destructor, or type conversion before ‘(’ token
102 | DLLExport __declspec(dllexport) void _CDECL nnue_init(
| ^
nnue.h:111:21: error: expected constructor, destructor, or type conversion before ‘(’ token
111 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_fen(
| ^
nnue.h:133:21: error: expected constructor, destructor, or type conversion before ‘(’ token
133 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate(
| ^
nnue.h:150:21: error: expected constructor, destructor, or type conversion before ‘(’ token
150 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_incremental(
| ^
In file included from board_declaration.h:4,
from see.cpp:2:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from board_declaration.h:4,
from bitboard.h:5,
from make_move.h:7,
from uci.h:8,
from uci.cpp:1:
board.h:22:23: warning: integer constant is so large that it is unsigned
22 | uint64_t H_FILE = 9259542123273814144;
| ^~~~~~~~~~~~~~~~~~~
board.h:24:24: warning: integer constant is so large that it is unsigned
24 | uint64_t GH_FILE = 13889313184910721216;
| ^~~~~~~~~~~~~~~~~~~~
In file included from evaluate.h:7,
from search.h:10,
from uci.h:11,
from uci.cpp:1:
nnue.h:102:25: error: expected constructor, destructor, or type conversion before ‘(’ token
102 | DLLExport __declspec(dllexport) void _CDECL nnue_init(
| ^
nnue.h:111:21: error: expected constructor, destructor, or type conversion before ‘(’ token
111 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_fen(
| ^
nnue.h:133:21: error: expected constructor, destructor, or type conversion before ‘(’ token
133 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate(
| ^
nnue.h:150:21: error: expected constructor, destructor, or type conversion before ‘(’ token
150 | DLLExport __declspec(dllexport) int _CDECL nnue_evaluate_incremental(
| ^
uci.cpp: In function ‘int gettimeofday(timeval*, timezone*)’:
uci.cpp:51:5: error: ‘SYSTEMTIME’ was not declared in this scope
51 | SYSTEMTIME system_time;
| ^~~~~~~~~~
uci.cpp:52:5: error: ‘FILETIME’ was not declared in this scope; did you mean ‘ETIME’?
52 | FILETIME file_time;
| ^~~~~~~~
| ETIME
uci.cpp:55:20: error: ‘system_time’ was not declared in this scope
55 | GetSystemTime(&system_time);
| ^~~~~~~~~~~
uci.cpp:55:5: error: ‘GetSystemTime’ was not declared in this scope
55 | GetSystemTime(&system_time);
| ^~~~~~~~~~~~~
uci.cpp:56:41: error: ‘file_time’ was not declared in this scope
56 | SystemTimeToFileTime(&system_time, &file_time);
| ^~~~~~~~~
uci.cpp:56:5: error: ‘SystemTimeToFileTime’ was not declared in this scope
56 | SystemTimeToFileTime(&system_time, &file_time);
| ^~~~~~~~~~~~~~~~~~~~
uci.cpp: In function ‘void parse_go(char*)’:
uci.cpp:353:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::chrono::duration<long int, std::ratio<1, 1000> >::rep’ {aka ‘long int’} [-Wformat=]
353 | printf("Time (ms): %d\n", chrono::duration_cast<chrono::milliseconds>(end - start).count());
| ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| int std::chrono::duration<long int, std::ratio<1, 1000> >::rep {aka long int}
| %ld
Thanks, I'll look at the makefiles soon, and I'll also rename the Board files to lowercase. Thanks again for pointing out this issue, I really appreciate it
As of commit daab229, Mida now has a makefile and can be compiled on all OS
hi, i just found your engine and i'm interested .. but i'm unable to compile on my Xubuntu 22.04, i get lots of errors .. first of all, including
windows.h
is not needed on Linux, i always comment-out these code lines, Linux doesn't need them .. but Linux is case sensitive concerning file names .. so i had to rename the Board.c/h files .. more errors remain though, i had to quit my fix .. i can send you the full terminal log.creating a general makefile could assist users of all OS ?