Roblox Man225
Roblox Man225

Reputation: 75

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

The first time I compiled and ran my program in dev console when I opened it my pc started lagging and it created a bunch of .tmp files on my desktop with names like trzFE47.tmp and my pc started lagging I had to turn off my pc I even checked the background processes with task manager for something suspicious but I found nothing so when I rebooted my pc I went to compile my .cpp program again avast gave me a warning saying suspicious item detected heres my code

#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;
}

Upvotes: 0

Views: 6843

Answers (3)

user1645254
user1645254

Reputation: 11

Best method which worked for me is to put the program in the "Allow" list in the antivirus's (Avast's) "Allowed & Blocked apps" menu in the settings.

Upvotes: -1

user14372492
user14372492

Reputation:

To test that your compiled file has a virus or not Just put your compiling folder in the exceptions of your antivirus and then right-click on that .exe file and scan with your antivirus. If it reports a virus then it is sure that you file contains a virus and if not it should say no viruses or malware found. Worked For Me:)

Upvotes: 0

Assimilater
Assimilater

Reputation: 964

Avast tends to think any program it hasn't seen before is "suspicious". Usually it "scans" the program, doesn't find anything and lets you carry on executing. With most anti-virus systems it's a good idea to add the folder you compile your code in to an exclusion list.

A side not about your program, and as was pointed out, you can't call main()

Upvotes: 5

Related Questions