C++ Visual Studio 访问被拒绝错误 [英] C++ Visual Studio Access is Denied error

查看:74
本文介绍了C++ Visual Studio 访问被拒绝错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 Microsoft Visual Studio 2017 并使用开发人员命令提示符编译和运行 C++

I installed Microsoft Visual Studio 2017 and am using the Developer Command Prompt to compile and run C++

我写了一个简单的程序,它有一个函数返回一个有符号整数的绝对值,接受来自用户的输入并打印该绝对值.

I wrote a simple program, that has a function that returns Absolute value of a signed int, accepts an input from the user and prints that abs value.

我编译了代码,它运行了,运行了一次,运行了,然后当我再次输入程序名称进行第二次运行时,我得到访问被拒绝,除非我重新编译,否则我之前只能运行一次程序我收到拒绝访问错误...

I compiled the code and it worked, ran it once and it worked, then when I typed the program name again to run a second time, I get Access is Denied, unless I recompile, I can only run the program once before I get Access is Denied error...

我写的一个简单的 Hello World 程序没有这个问题,所以不确定发生了什么

I didn't have this problem on a simple Hello World program I wrote so not sure what is going on

感谢任何帮助=

我的代码很简单---

#include <iostream>
using namespace std;

signed int Abs(signed int x);

int main()
{
    signed int n;
    cout << "Enter n to get signed int abs value of: ";
    cin >> n;

    cout << "Signed int: ";
    signed int s = Abs(n);
    cout << s;

    return 0;
}

signed int Abs(signed int x) {
    return (x + (x >> 31)) ^ (x >> 31);
}

在我的终端中输入

cl /EHsc signedint.cpp

然后

signedint

它只工作一次

当我输入时

signedint 

我第二次遇到错误-

Access is denied.

就是这样.

推荐答案

自己解决了问题,是norton杀毒干扰的问题.

Solved the problem myself, it was a problem with norton antivirus interfering.

要解决此问题,您必须进入 Norton Antivirus 中的设置、Antivirus settings,单击Scans and Risks",然后将您的项目文件夹添加到 Exclude from Auto Protect、Sonar 和 Download Intelligence Detection and Exclude from Scans by点击这两个选项旁边的配置按钮.

To fix this problem, you have to go into settings in norton antivirus, Antivirus settings, click on "Scans and Risks", and add your project folder to Exclude from Auto Protect, Sonar and Download Intelligence Detection and Exclude from Scans by clicking the configure button next to those two options.

这篇关于C++ Visual Studio 访问被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆