简体   繁体   中英

VS Code cant run C/C++ in integrated Terminal

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM