Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get error "No such file or directory" when I compile C code using gitbash as terminal #296

Closed
waithope opened this issue Apr 18, 2018 · 12 comments

Comments

@waithope
Copy link

waithope commented Apr 18, 2018

Here is the output info:

$ cd "d:\VscodeProject\C\demo\" && gcc file1.c -o file1 && "d:\VscodeProject\C\demo\"file1
bash: cd: d:\VscodeProject\C\demo" && gcc file1.c -o file1 && d:VscodeProjectCdemo"file1: No such file or directory

How can I fix it?

@formulahendry
Copy link
Owner

formulahendry commented Apr 18, 2018

What's the path of your Git Bash?
Could you set "code-runner.terminalRoot": "/", and try again?

@waithope
Copy link
Author

@formulahendry, it works. Thank you for the prompt reply.

@RockerSurajThakur
Copy link

I didn't get the answer please elaborate

@RockerSurajThakur
Copy link

Guys I was trying to execute C programme for last 3 days but didn't get the answer but today I worked hard and finally it worked for me.

Please try this for C programme
"c": "gcc $fileNameWithoutExt.c -o $fileNameWithoutExt && ./$fileNameWithoutExt.exe"

for cpp
"c": "g++ $fileNameWithoutExt.c -o $fileNameWithoutExt && ./$fileNameWithoutExt.exe"

@devsungyeon
Copy link

it works. thx!

@Dhaval1112000
Copy link

I didn't get the answer please elaborate
Simply go to the settings and open the settings.json file. Paste this thing
"code-runner.terminalRoot": "/"
in the file and you are ready to go

@deepakpandey710
Copy link

@Dhaval1112000 it works thank you so much

@luffylovesmeat
Copy link

I didn't get the answer please elaborate

press ctrl+shift+p then search settings and open settings.json and add the line "code-runner.terminalRoot": "/" to the code

@adi1719
Copy link

adi1719 commented Nov 26, 2021

didn't work

cd : Cannot find path 'C:\Users\adira\Desktop\C Tutorials\truec\Users\adira\Desktop\C Tutorials' because it does not exist.
At line:1 char:1

  • cd "truec/Users/adira/Desktop/C Tutorials/" ; if ($?) { gcc If else s ...
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\adira\...op\C Tutorials\:String) [Set-Location], ItemNotFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
    

@Himanshupegu
Copy link

I didn't get the answer please elaborate

press ctrl+shift+p then search settings and open settings.json and add the line "code-runner.terminalRoot": "/" to the code

Thanks it works

@Agustinez02
Copy link

¿Cuál es el camino de tu Git Bash? ¿Podría configurar y volver a intentarlo?"code-runner.terminalRoot": "/"

Graaaaciaaaa

What's the path of your Git Bash? Could you set "code-runner.terminalRoot": "/", and try again?

thaaaaanks bro, i love you

@dneovu
Copy link

dneovu commented Feb 7, 2023

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests