1

When I run the below given code on Visual Studio Code, first Building it, but it shows:

> Executing task: g++ -g main.cpp <

d:/software/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot open output file a.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
The terminal process "C:\Program Files\Git\bin\bash.exe '-c', 'g++ -g main.cpp'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I have Bitdefender Antivirus on the system. It showed an error describing "Infected File Detected", it detected a.exe file and after that I removed it from quaratine and deleted the file from there in the Bitdefender software but now I am not able to run cpp file.

#include <iostream>
using namespace std;
class Aclass
{
public:
    int x = 0, y = 0;
    Aclass() { cout << "constructor of Aclass" << endl; }
}
int main () {
    Aclass b;
}

I tried some solutions from stack and other forums but didn't work, though other forums there is nothing much but on stack I found one with solution to turn ON "Application Experience", but unfortunately I cant find it on services.msc

Any help will be much appreciated. Thank You.

Leprachon
  • 117
  • 1
  • 8
  • What is the program supposed to do? It does nothing now. Why put `class` in the name of the class. – rioV8 Jul 20 '20 at 11:21
  • @rioV8 actually this is a dummy code, just a short part. And the code here display "constructor of Aclass". – Leprachon Jul 20 '20 at 11:26
  • Not with this code – rioV8 Jul 20 '20 at 11:26
  • Oh yes. I am so sorry. Thank you @rioV8 . I edited the question. – Leprachon Jul 20 '20 at 11:31
  • @Leprachon, Why did you delete your last question: https://stackoverflow.com/questions/63440538/game-of-life-gui-issue-with-displaying-matrix. I was about to give you some tips on how to do painting. – camickr Aug 16 '20 at 18:35

1 Answers1

0

I was also facing this same problem. To solve it you should open Bitdefender, then go to Exclusions setting, select Add a folder, and then navigate to your MINGW folder installation. Note that you have to select the entire MINGW folder, and then save it. Restart your system and then Visual Studio Code will not show this error.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77