2

So I am trying to Setup C/C++ in VS Code. I installed mingw, the C/C++ Extension in VSCode and Code Runner Code Runner has the following Setting turned on: RunInTerminal

This is the Code I try to run:

#include<stdio.h>

int main()
{
    int age;
    printf("Enter age\n");
    scanf("%d", &age);
    printf("Age is %d", age);
    return 0;
}

When I click on the run button from Code-Runner the Terminal generates this output:

$ cd "c:\Users\alexa\Desktop\Projekte\C\" && g++ test.cpp -o test && "c:\Users\alexa\Desktop\Projekte\C\"test
bash: cd: c:\Users\alexa\Desktop\Projekte\C" && g++ test.cpp -o test && c:UsersalexaDesktopProjekteC"test: No such file or directory

I know that the problem is that there a missing backslashes in the path used in bash

c:UsersalexaDesktopProjekteC"test

But i cant find a way to fix it. I am on Windows 10

oguz ismail
  • 1
  • 16
  • 47
  • 69

1 Answers1

3

This can be an issue with code-runner extension I have similar like Issue but sometimes my code executable runs and then it crashes . So i try to run them in terminal

If the terminal option still Dosen't work , This can be your antivirus causing the issue . Your antivirus treats the C/C++ executable file as malware and prevents it from executing It . so Try disabling your antivirus in control panel or uninstall it

iceweasel
  • 756
  • 1
  • 6
  • 11