当我编译我的c++代码时,avast认为这是一种病毒

when i compile my c++ code avast thinks its a virus

本文关键字:病毒 一种 我的 编译 c++ 代码 avast      更新时间:2023-10-16

当我第一次在开发控制台中编译和运行程序时,当我打开它时,我的电脑开始滞后,它在我的桌面上创建了一堆名为trzFE47.tmp的.tmp文件,我的计算机开始滞后。我不得不关闭我的电脑。我甚至与任务管理器一起检查了后台进程中的可疑内容,但我没有发现任何可疑内容,所以当我重新启动电脑时,我开始编译我的.cpp程序再次向我发出警告,说在我的代码中检测到可疑物品

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
using namespace std;
int main() {
    int l;
    int a;
    int b;
    int c;
    Sleep(3000);
    srand(time(0));
    l = 1+rand()%6;
    a = 1+rand()%6;
    b = 1+rand()%6;
    c = 1+rand()%6;
    cout << a  << endl << b << endl << c << endl;
    if (a==b&& b==c&&c==a){
        int v;
        cout << "you win";
        cin >> v;
    }else{
        cout << "try again?";
        string z;
        cin >> z;
        if (z == "yes"){
            main();
        }
    }
    return 0;
}

Avast倾向于认为它以前从未见过的任何程序都是"可疑的"。通常它会"扫描"程序,找不到任何东西,然后让你继续执行。对于大多数防病毒系统,最好将编译代码的文件夹添加到排除列表中。

一方面与您的程序无关,正如所指出的,您不能调用main()

要测试编译的文件是否有病毒,只需将编译文件夹放在防病毒软件的例外中,然后右键单击该.exe文件并使用防病毒软件进行扫描。如果它报告了病毒,那么它确定你的文件包含病毒,如果没有,它应该说没有发现病毒或恶意软件。为我工作:)

对我来说最好的方法是将程序放在;允许";防病毒的列表(Avast’s)";允许的&被阻止的应用程序"菜单。

相关文章: