What happened to GCC?
Moderators: chrisw, Rebel, Ras
-
- Posts: 1408
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Budapest, Hungary
- Full name: Gabor Szots
What happened to GCC?
Recently, when I try to use gcc with the command line "gcc *.c etc." I get an error message that *.c is an invalid argument. I'd be grateful if someone here could explain why is that and whether there is a solution.
Gabor Szots
CCRL testing group
CCRL testing group
-
- Posts: 11
- Joined: Mon Dec 23, 2024 1:32 am
- Full name: Anatoliy Sova
Re: What happened to GCC?
I believe you need to provide exact list of .c files to gcc for compile - like gcc myfile1.c myfile2.c
-
- Posts: 408
- Joined: Sat May 05, 2012 2:48 pm
- Full name: Oliver Roese
Re: What happened to GCC?
Nothing of course, it looks like as if the shell you were using could not expand your globbing pattern and in turn left it as is, hence the compiler stumbled over it. Could that be?
What do you want to do? Could it be, that you are not an experienced coder, since you are trying to do something that you normally never should do?
If you want to compile the source code of a given engine for yourself you should use the build system provided. I also would recommend to always ask a coding model for assistance, it is the way it goes in the future. Resistance is futile
What do you want to do? Could it be, that you are not an experienced coder, since you are trying to do something that you normally never should do?
If you want to compile the source code of a given engine for yourself you should use the build system provided. I also would recommend to always ask a coding model for assistance, it is the way it goes in the future. Resistance is futile
-
- Posts: 1408
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Budapest, Hungary
- Full name: Gabor Szots
Re: What happened to GCC?
That would be a pain when there are 10 or more source files.fire_varan wrote: ↑Wed Jan 01, 2025 9:37 pm I believe you need to provide exact list of .c files to gcc for compile - like gcc myfile1.c myfile2.c
Gabor Szots
CCRL testing group
CCRL testing group
-
- Posts: 11
- Joined: Mon Dec 23, 2024 1:32 am
- Full name: Anatoliy Sova
Re: What happened to GCC?
You could construct a .bat or .sh file and just run it. Or use tool like make / CMake.
-
- Posts: 1408
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Budapest, Hungary
- Full name: Gabor Szots
Re: What happened to GCC?
I am not an experienced coder. In fact I am not a coder at all. However, I have compiled lots of chess engines from source using '*.c'. But now, for some time, that has not been possible. I'm on Win11 23H2.BeyondCritics wrote: ↑Wed Jan 01, 2025 11:20 pm Nothing of course, it looks like as if the shell you were using could not expand your globbing pattern and in turn left it as is, hence the compiler stumbled over it. Could that be?
What do you want to do? Could it be, that you are not an experienced coder, since you are trying to do something that you normally never should do?
If you want to compile the source code of a given engine for yourself you should use the build system provided. I also would recommend to always ask a coding model for assistance, it is the way it goes in the future. Resistance is futile
When you say 'you should use the build system provided' I guess you mean the makefile, don't you?
And when you say 'ask a coding model for assistance' I simply don't know what you are taling about.
Gabor Szots
CCRL testing group
CCRL testing group
-
- Posts: 254
- Joined: Sat Mar 11, 2006 8:31 am
- Location: Malmö, Sweden
- Full name: Bo Persson
Re: What happened to GCC?
Yes, that is the problem. On Linux the shell will expand *.c and feed that list to the compiler. The standard Windows console does not do anything like that.Gabor Szots wrote: ↑Thu Jan 02, 2025 7:52 am However, I have compiled lots of chess engines from source using '*.c'. But now, for some time, that has not been possible. I'm on Win11 23H2.
So it has nothing to do with gcc, it is the environment.
-
- Posts: 3656
- Joined: Thu Jun 07, 2012 11:02 pm
Re: What happened to GCC?
How about Windows Powershell ? Same ?Bo Persson wrote: ↑Thu Jan 02, 2025 10:44 am Yes, that is the problem. On Linux the shell will expand *.c and feed that list to the compiler. The standard Windows console does not do anything like that.
-
- Posts: 1408
- Joined: Sat Jul 21, 2018 7:43 am
- Location: Budapest, Hungary
- Full name: Gabor Szots
Re: What happened to GCC?
It was OK a couple of months ago. My typical command looked like this: gcc *.c -O3 -flto -march=native -oSomething.exe, and it usually worked. I use Total Commander as a file manager and I issue commands from there.Bo Persson wrote: ↑Thu Jan 02, 2025 10:44 am So it has nothing to do with gcc, it is the environment.
There were a couple of Windows updates lately, maybe they ruined something.
Thanks for the hints.
Gabor Szots
CCRL testing group
CCRL testing group
-
- Posts: 669
- Joined: Sat Jun 08, 2013 10:07 am
- Location: France
- Full name: Roland Chastain
Re: What happened to GCC?
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.
When I type make in a terminal, I can see the command sent to gcc:
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 $@ $^
That Makefile should work for any C program. It will work also under Windows, provided that you have make.exe.[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
Qui trop embrasse mal étreint.