Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

“Access is Denied error” in C++ Visual Studio and How to resolve it

  • Difficulty Level : Basic
  • Last Updated : 08 Dec, 2021

Pre-requisite: How to Install Visual C++ on Windows

In this article, we will discuss about access denied error in Visual Studio in C++.

What is Access denied error in Visual Studio in C++?

Access denied error in Visual Studio in C++ occurs when there is an attempt to access one of the installation files and due to some reason the access is denied to the requested file. There can be several reasons for it. This article focusses on discussing the access denied error encountered while running a C++ program in Visual Studio.

Why does Access denied error occurs?

The access denied error occurs when Visual Studio is unable to access one or more installation files. This error can occur due to one of the following reasons:

  1. An outside process like an antivirus or anti-malware application has locked a Visual Studio installation file while Visual Studio was installing the files at the time of the installation. 
  2. The user installing the Visual Studio does not have administrative privileges to successfully install all the files. To install Visual Studio, the user must be Admin and must start the installer by right clicking and select Run as Administrator option.
  3. Permissions on some registry or hives can prevent Visual Studio from installing all the files.

How to resolve this error

One of the solution to resolve the error is to make changes in the anti-virus software to unlock the Visual Studio installation file. Below is the screenshot of the error encountered while running a C++ program in Visual Studio.

Access Denied Error

Error message

There are various methods to install VS Code and MinGW(C compiler) but when these are used to run a code it may show some error in output or in VS code terminal. But it might not be the case that the installation process is incorrect. It’s because of the system’s anti-virus that is blocking the VS code to get access to the MinGW’s bin folder. 

Steps to resolve the error:
Below are the steps to resolve the error in McAfee anti-virus software.

Step 1: Open McAfee antivirus application.

McAfee antivirus application

Step 2: Find the settings option then click on it.
Step 3: Click on the Real-Time Scanning option. Here one can find more options.

Real-Time scanning

Step 3: The last step is to click on the Turn Off button and turn it off as long as you want. This option will turn off the real-time scanning.

Turn off real-time scanning

With these simple steps one can easily turn on and off the anti-virus and will not face problems anymore. Also there is option to exclude some individual files from the scan by adding them to the exclude files section and the anti-virus scan will skip that particular folder while performing the computer scan.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!