问题
I'm using MinGW GCC compiler on windows how to compile all C files in a directory.
I used
gcc *.c -o Output
after I entered the required folder and I got this error
gcc: error: *.c: Invalid argument
gcc: fatal error: no input files
compilation terminated.
the used version of GCC is 4.7.1
回答1:
For anyone else like me who's come across this problem:
I ran into this problem when I installed MinGW-w64 on my tablet after having run it for a few years on my desktop.
Basically, I have a ruby script that does some basic compilation stuff for me, and it was breaking at the linking stage on my tablet (developed on, and ran fine on the desktop).
The error: Invalid Argument, no input files (as in the original question).
If you check around, you'll find a few places that tell you that the issue is due to the way CMD on Windows handles passing wildcards to programs (vs UNIX shells).
Basically Windows leaves interpretation of the wildcard up to the program.
Some builds of MinGW can handle a wildcard from CMD, whereas others won't.
I'm able to use wildcards using the MinGW-W64-builds installer for MinGW-W64.
回答2:
This should work with older mingw-w64 versions:
#ifdef __MINGW64_VERSION_MAJOR
int _dowildcard = -1; /* enable wildcard expansion for mingw-w64 */
#endif
来源:https://stackoverflow.com/questions/39360051/mingw-gcc-wildcard