What happened to GCC?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Gabor Szots
Posts: 1414
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: What happened to GCC?

Post by Gabor Szots »

Roland Chastain wrote: Thu Jan 02, 2025 6:53 pm Don't know why it doesn't work for you. It still works here (Linux).

I would use a Makefile. For example this one I have made for an engine named Leonidas.

Code: Select all

SRC := $(wildcard *.c)

leonidas: ${SRC}
	gcc -o $@ $^
When I type make in a terminal, I can see the command sent to gcc:
[roland@localhost leonidas-makefile]$ make
gcc -o leonidas bitboard.c board.c evaluate.c game.c genrand.c hashkey.c hashtable.c keypressed.c leo.c move.c movegen.c perft.c pieces.c play.c search.c see.c square.c timer.c variants.c xboard.c
That Makefile should work for any C program. It will work also under Windows, provided that you have make.exe.
Well, it seemed to work (it did not complain of the arguments) but I don't know how to include c files from subdirectories (such as pyrrhic and incbin), also how to make it include h files from those two folders.
I guess I will have to learn how to construct a makefile.

Thanks anyway.
Gabor Szots
CCRL testing group
User avatar
flok
Posts: 545
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: What happened to GCC?

Post by flok »

Gabor Szots wrote: Thu Jan 02, 2025 9:37 pm
Roland Chastain wrote: Thu Jan 02, 2025 6:53 pm Don't know why it doesn't work for you. It still works here (Linux).

I would use a Makefile. For example this one I have made for an engine named Leonidas.

Code: Select all

SRC := $(wildcard *.c)

leonidas: ${SRC}
	gcc -o $@ $^
When I type make in a terminal, I can see the command sent to gcc:
[roland@localhost leonidas-makefile]$ make
gcc -o leonidas bitboard.c board.c evaluate.c game.c genrand.c hashkey.c hashtable.c keypressed.c leo.c move.c movegen.c perft.c pieces.c play.c search.c see.c square.c timer.c variants.c xboard.c
That Makefile should work for any C program. It will work also under Windows, provided that you have make.exe.
Well, it seemed to work (it did not complain of the arguments) but I don't know how to include c files from subdirectories (such as pyrrhic and incbin), also how to make it include h files from those two folders.
I guess I will have to learn how to construct a makefile.

Thanks anyway.
Please try:

SRC := $(wildcard *.c) $(wildcard pyrrhic/*.c)
CFLAGS=-Ipyrrhic -Iincbin

Not tested but it may work.
User avatar
Gabor Szots
Posts: 1414
Joined: Sat Jul 21, 2018 7:43 am
Location: Budapest, Hungary
Full name: Gabor Szots

Re: What happened to GCC?

Post by Gabor Szots »

flok wrote: Thu Jan 02, 2025 10:09 pmPlease try:

SRC := $(wildcard *.c) $(wildcard pyrrhic/*.c)
CFLAGS=-Ipyrrhic -Iincbin

Not tested but it may work.
Yes, it works. Thank you very much.
Gabor Szots
CCRL testing group
BeyondCritics
Posts: 409
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: What happened to GCC?

Post by BeyondCritics »

You can add your own options to the CFLAGS variable.
Generally you should always use the shell which comes with your compiler, for several reasons.
If you want to try AI generated code, head over to e.g. https://claude.ai/new, make a free account and tell it your problem. It believe it's a perfect fit for you.