How to compile a c file with multiple words name

2020-03-26 c gcc

I'm very very new to programming and mostly self taught (using command prompt). I tried to compile a c file that has multiple words as its filename and it showed error for all the words.

Example:

C:\Users\User\Desktop\Programming\toCompile>gcc -o Even or odd.exe Even or Odd determinator.c

gcc: error: or: No such file or directory

gcc: error: odd.exe: No such file or directory

gcc: error: Even: No such file or directory

gcc: error: or: No such file or directory

gcc: error: Odd: No such file or directory

gcc: error: determinator.c: No such file or directory

gcc: fatal error: no input files

compilation terminated.

Do I have to rename the c files to one word names or is there another way?

Answers

Surround the file names in ' or ".

gcc -o 'Even or odd.exe' 'Even or Odd determinator.c'

But in the future, I'd avoid spaces in file names. Some build systems (make) can't work with spaces.

Related