Unable to run files with spaces in filename


#1

Hi! I’m trying to run a CPP file (for example, “Hello world.cpp”) but the compiler throws this error:

Running /home/ubuntu/workspace/Hello world.cpp
g++: error: /home/ubuntu/workspace/Hello: No such file or directory
g++: error: world.cpp: No such file or directory
g++: error: world.cpp.o: No such file or directory
g++: fatal error: no input files
compilation terminated.

Running files without spaces in their filename work just fine. Is there I can do about it (besides replacing every space with a character such as ‘_’), or it is a c9 bug?


#2

It’s very much not standard to have spaces in your file names. I’d strongly suggest renaming all files to not have spaces in them.

There is a way to run a file with spaces in it that involves using backslashes but it will make your life easier if you comply with the standard. If you’re dead set on making your life difficult then a quick Google should help you out :wink: