Probably makefile does contain a proper target for debug even though I don't know whether it is so or not and how to use it.hgm wrote: ↑Sun Mar 14, 2021 12:40 pmSounds like a broken Makefile, right?Ras wrote: ↑Sun Mar 14, 2021 12:08 pmDid you try "make clean" to remove object files compiled against the previous definition of Position?maksimKorzh wrote: ↑Sun Mar 14, 2021 11:48 amI've already read about one definition rule but I don't understand how is it possible that compiler thinks I'm having more than one definition of Position class.
The way I build is: make build ARCH=x86-64 COMP=gcc
and the last line before it compiles: g++ -o stockfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o thread.o timeman.o tt.o uci.o ucioption.o syzygy/tbprobe.o -m64 -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -flto
feels like it's a build for release, not debug, so I guess the problem is that I don't know how to properly work with multiple files in C/C++.
I only mostly did single file engines hence never was bothered by thinking about the linking process.
However the object files holding Position class should be recompiled if change occurs but this didn't happen hence this error, so the
linker thought as if there were 2 different Position class definitions.
Btw, I had a very surprising experiment today - my JS engine passes perft 5 in starting positions almost as fast as Fairy SF and even faster than Chameleon (SF 7 derivative that plays xiangqi). Here's a video:
Fairy SF author Fabien Fitcher explained me the reasons behind it here:
https://github.com/ianfab/Fairy-Stockfish/issues/278