Issue
I'm getting errors when I try to name an C file with '&' (like 'Sum of Int&float'). But the error is cleared when I remove the '&'. Why does naming with '&' produce errors.I am using Eclipse IDE for c/c++ 2021-03.
make all
Building file: ../src/int&float.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/int&float.d" -MT"src/int&float.o" -o "src/int&float.o" "../src/int&float.c"
Finished building: ../src/int&float.c
Building target: Sum of int&float
Invoking: GCC C Linker
gcc -o "Sum of int&float" ./src/int&float.o
/bin/sh: 1: float.o: not found
make: *** [makefile:32: Sum of int&float] Error 127
gcc: error: ./src/int: No such file or directory
gcc: fatal error: no input files
compilation terminated.
"make all" terminated with exit code 2. Build might be incomplete.
18:02:24 Build Failed. 1 errors, 0 warnings. (took 685ms)```
Solution
The &
character is a special character to the shell, used to put a process in the background.
You could put the filename in quotes, but it's best to avoid using that character in filenames for reasons like this.
Answered By - dbush