skip to Main Content

VS Code block after running When I am running my c programming code in VS Code, why is it showing a msg as "no such file or directory"?
How to resolve this issue?

I had made a file and then I wrote the code and saved it then clicked run.
And then clicked on terminal and then typed gcc... gcc filename.c
. I have already installed extension of c/c++, code runner yet the problem still persists.

2

Answers


  1. Make sure you are opened into the right directory in visual studio code. In the upper left hand corner you will see What folder you are in. Use cd commands in the terminal like:

    cd Desktop/programming
    

    and direct it to the right directory. Then try compiling again.

    Login or Signup to reply.
  2. You are editing mymain.c/testcode.c, but you are attempting to compile testcode.c.

    One solution is to switch into mymain.c

    cd mymain.c
    gcc testcode.c
    

    Alternatively, you could provide the correct path.

    gcc mymain.c/testcode.c
    

    Your choice will affect the default location of the output files, as well as the base directory for #include "..." directives (but it doesn’t affect #include <...> directives).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search