Visual Studio Code Extension: "Code Runner" does not compile C

Asked

Viewed 3,351 times

-1

I’m trying to run a code on C in the Visual Studio Code with the extent Code Runner but I’m not getting it. I’ve installed the Mingw correctly, I can verify it in cmd via

g++ --version

But I still can not run C in Vscode. I know that VS is not the most indicated but wanted to centralize my work in a single editor.

The message that appears when I try to run is the following:

[Running] cd "c:\Users\henrique\Documents\_minhas-coisas\_Faculdade\TesteVSCode\C\" &&
             gcc first.c -o first && 
             "c:\Users\henrique\Documents\_minhas-coisas\_Faculdade\TesteVSCode\C\"first
             'gcc' n�o � reconhecido como um comando interno
             ou externo, um programa oper�vel ou um arquivo em lotes.

[Done] exited with code=1 in 0.188 seconds

The First is the name of arquivo.c

  • Try with the extension c/c++ this plugin ... in the documentation is indicated it instead of the core Runner. tried on linux with gcc and it worked well.

1 answer

0

Create an environment variable in PATH with the way to the gcc. PATH is a system variable used by the operating system to locate executables that will be used by command line.

Follow the instructions:

System Config. Advanced of the System Variables of Environment Add the variable in question to the path

  • I changed and only changed the error... Now it points out that you cannot open the file due to lack of permission. [Running] cd "c: Users Henrique Documents_meus-coisas_Faculdade Testevscode C" && gcc first. c -o first && "c: Users Henrique Documents_minhas-coisas_Faculdade Testevscode C"first C:/mingw-W64/mingw64/bin/.. /lib/gcc/x86_64-W64-mingw32/8.1.0/.. /.. /.. /.. /x86_64-W64-mingw32/bin/Ld.exe: cannot open output file first.exe: Permission denied collect2.exe: error: Ld returned 1 Exit status [Done] exited with code=1 in 0.193 Seconds

  • has tried to run as an administrator?

  • I hadn’t tried, but I tried now and the file just stopped working. I even created a new file to see if it was with those the problem but continues the same warning, without permission.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.