franneck94 / Vscode-C-Cpp-Runner

šŸš€ Compile, run and debug single or multiple C/C++ files with ease. šŸš€
MIT License
53 stars 14 forks source link

Build task fails for paths containing spaces #37

Closed Xevion closed 2 years ago

Xevion commented 2 years ago

Opening a new issue instead of appending onto the other one.

> Executing task: gcc -Wall -Wextra -Wpedantic --std=c99 -g3 -O0 -If:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records -c f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\main.c -o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\main.o && gcc -Wall -Wextra -Wpedantic --std=c99 -g3 -O0 -If:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records -c f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\route-records.c -o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\route-records.o && gcc -Wall -Wextra -Wpedantic --std=c99 -g3 -O0 -If:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\main.o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\route-records.o -o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\outDebug.exe <

gcc.exe: error: 2021\CS-1714-0D1\Projects\route-records: No such file or directory
gcc.exe: error: f:\UTSA\Classes\Fall: No such file or directory
gcc.exe: error: 2021\CS-1714-0D1\Projects\route-records\main.c: No such file or directory
gcc.exe: error: 2021\CS-1714-0D1\Projects\route-records\build\Debug\main.o: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
The terminal process "C:\Windows\System32\cmd.exe /d /c gcc -Wall -Wextra -Wpedantic --std=c99 -g3 -O0 -If:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records -c f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\main.c -o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\main.o && gcc -Wall -Wextra -Wpedantic --std=c99 -g3 -O0 -If:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records -c f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\route-records.c -o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\route-records.o && gcc -Wall -Wextra -Wpedantic --std=c99 -g3 -O0 -If:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\main.o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\route-records.o -o f:\UTSA\Classes\Fall 2021\CS-1714-0D1\Projects\route-records\build\Debug\outDebug.exe" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Basically, my understanding is that the extension can't run the Build task because it has a space in it. Look how the errors reported are split on the space between "Fall" and "2021" (originally a folder "Fall 2021").

I'm guessing surrounding the paths with quotes would fix this, but you'd know more.

Yes, I could just rename the folder and see if it works but maybe you'd like to know of this being possible.

Thanks for the quick fix though on #35 though.

franneck94 commented 2 years ago

Hi, yes i can add this "feature". Nevertheless from a C/C++ programmers perspective you shouldnt have spaces in the path. Many UNIX like tools don't like this.

franneck94 commented 2 years ago

I will update the build and run function for paths with spaces. The debugging however will not work on every system, since gdb can't cope with whitespaces on Unix like systems.