Running certain code in codeblocks sets off AVG?

From C++ to PHP, debugging to webhosting; help and discussion about writing your latest program to running your website. NOT for help when your PC won't work.

Announcements Posted on
Sign in to Reply
  1. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Running certain code in codeblocks sets off AVG?
    Hey, I've recently started to learn C++ and I'm using codeblocks as my IDE, but I keep getting problems with AVG free edition picking up random pieces of code as Trojans ?! I've put an example of some code that sets it off below, and the error message I get. Is there anyway I can set AVG not to trigger with any codeblocks coding I've done? I guess I could tell AVG not to trigger for that folder, if that's even possible? Thanks!

    Code:
    #include <iostream>
    
    using namespace std;
    
    class MyClass{
        public: 
            void coolSaying(){
                cout << "BUST A MOVE!!" << endl;
            }
    };
    
    int main()
    {
        MyClass myObject; 
        myObject.coolSaying();
        return 0;
    }
    Error I get :
    File name: h:\Desktop\C++ projects\classes and objects 1\bin\Debug\classes and projects 1.exe
    Threat name: Trojan horse Agent3.BMSZ
    Detected on open.
  2. tamimi's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,568
    Re: Running certain code in codeblocks sets off AVG?
    I don't think this is sufficient code to figure out why it's setting off your anti virus.

    You'd have to examine the whole code. I'd suggest looking for open recursive functions, stuff like a while loop that wasn't given a closing condition or anything that may clog up processes, as that's something some antivirus software looks for.

    Also, "Bust a move!!" is not an appropriate tag. It's good practice to use meaningful tags - They help you figure out what you're on about, especially when writing a massive bit of code, to which you can come back in the future and understand/remember what you meant/what the code is doing.
    Last edited by tamimi; 03-07-2012 at 19:37.
  3. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by tamimi)
    I don't think this is sufficient code to figure out why it's setting off your anti virus.

    You'd have to examine the whole code. I'd suggest looking for open recursive functions, stuff like a while loop that wasn't given a closing condition or anything that may clog up processes, as that's something some antivirus software looks for.

    that is the whole code. :/
    Last edited by burgergetsbored; 03-07-2012 at 19:38.
  4. tamimi's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,568
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by burgergetsbored)
    that is the whole code. :/
    Okay. <tries it>

    I ran it without any issues.

    Could it be your compiler?

    Try using this online compiler instead. http://ideone.com
  5. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by tamimi)
    Okay. <tries it>

    I ran it without any issues.

    Could it be your compiler?

    Try using this online compiler instead. http://ideone.com
    are you running AVG though? I think it's specifically to do with AVG not the code? Seeing as the code is perfectly fine :/
    Last edited by burgergetsbored; 03-07-2012 at 19:45.
  6. tamimi's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,568
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by burgergetsbored)
    are you running AVG though? I think it's specifically to do with AVG not the code? Seeing as the code is perfectly fine :/
    I'm no expert but any average homo sapien in this situation may suggest switching AVG off or getting another anti virus.
  7. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by tamimi)
    I'm no expert but any average homo sapien in this situation may suggest switching AVG off or getting another anti virus.
    cant go turning off my anti virus every time I want to run some code though can I, so that's no good. Yes the simple thing to do would change anti-virus but I was hoping there would be someone on here who may have had the same problem and has a proper solution for this.
  8. tamimi's Avatar
    • Peer Of The TSR Realm
    • Posts: 1,568
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by burgergetsbored)
    cant go turning off my anti virus every time I want to run some code though can I, so that's no good. Yes the simple thing to do would change anti-virus but I was hoping there would be someone on here who may have had the same problem and has a proper solution for this.
    Not sure I like your tone. Unsubbing this thread to prevent a keyboard war.
  9. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Re: Running certain code in codeblocks sets off AVG?
    haha sorry about that, but your last post seemed to indicate any average person would have thought about changing anti-virus and I hadn't. I'm sure someone must have had this problem! A couple of the people on the video tutorial I watched said the same thing but no one had provided a solution.
  10. alex-hs's Avatar
    • Overlord in Training
    • Location: Nottingham
    • Posts: 3,088
    Re: Running certain code in codeblocks sets off AVG?
    I've compiled it (with whatever version of g++ comes with cygwin) and Microsoft Security Essentials seems to have no problem with it. I don't have AVG installed. Does it do it for any other programs you've written?

    By the way, I don't know what tamimi is on about wrt "meaningful tags"... yes it's important to have meaningful variable names, with the exception of throwaway variables (such as loop variables) in order to make your code self-documenting as far as possible, but since "BUST A MOVE!" is a string to be output, the comment is basically irrelevant. Simlarly with your 'tone'... seems fine to me :/
  11. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by alex-hs)
    I've compiled it (with whatever version of g++ comes with cygwin) and Microsoft Security Essentials seems to have no problem with it. I don't have AVG installed. Does it do it for any other programs you've written?

    By the way, I don't know what tamimi is on about wrt "meaningful tags"... yes it's important to have meaningful variable names, with the exception of throwaway variables (such as loop variables) in order to make your code self-documenting as far as possible, but since "BUST A MOVE!" is a string to be output, the comment is basically irrelevant. Simlarly with your 'tone'... seems fine to me :/
    thanks for checking, it must just be something to do with AVG, yes I also did another tutorial which I tried using a simple if statement which it also came up with a similar "Agent3" trojan. I'm going to have to do something about it, otherwise it doesn't look like I'll be able to do much in C++ :L I wouldn't have thought it be anything down to the IDE would it?

    oh yeah If I was properly doing something I know how to name all my variables correctly :L Just seeing as this was the only code in the program and it was only a string being output I can't see a problem with what's the actual text is!
  12. CJKay's Avatar
    • Overlord in Training
    • Location: England
    • Posts: 2,412
    Re: Running certain code in codeblocks sets off AVG?
    AVG is trolling you.
  13. Planto's Avatar
    • TSR Idol
    • Posts: 8,690
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by alex-hs)
    By the way, I don't know what tamimi is on about wrt "meaningful tags"... yes it's important to have meaningful variable names, with the exception of throwaway variables (such as loop variables) in order to make your code self-documenting as far as possible, but since "BUST A MOVE!" is a string to be output, the comment is basically irrelevant. Simlarly with your 'tone'... seems fine to me :/
    I raised an eyebrow, too. Some odd folk drifting around here. Must have too much time on their hands.
  14. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Re: Running certain code in codeblocks sets off AVG?
    ah well sent the file to AVG to have checked and they can't see any problem?! Looks like I'll have to try avast!
  15. Psyk's Avatar
    • TSR Royalty
    • Location: Leamington Spa
    • Posts: 19,081
    Re: Running certain code in codeblocks sets off AVG?
    I suspect it's just sheer fluke. Your compiled program just so happens to look a little similar to a known trojan. It's rare, but it happens. Change the code a bit (in a way that would actually affect the compiled output, not just changing comments or variable names) and it probably won't happen.

    Had a similar thing at work. One of the thousands of files that were processed happened to set off the anti-virus. A slight change to the source data and the problem went away.
  16. burgergetsbored's Avatar
    • Exalted and Worshipped Member
    • Posts: 911
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by Psyk)
    I suspect it's just sheer fluke. Your compiled program just so happens to look a little similar to a known trojan. It's rare, but it happens. Change the code a bit (in a way that would actually affect the compiled output, not just changing comments or variable names) and it probably won't happen.

    Had a similar thing at work. One of the thousands of files that were processed happened to set off the anti-virus. A slight change to the source data and the problem went away.
    haha all it does is print to command line! I switched to avast a while back now and haven't had problems since, and avast gives you the option of carrying on executing if something is detected whereas AVG didn't. I'll try changing the code a little next time something comes up, cheers.
  17. Psyk's Avatar
    • TSR Royalty
    • Location: Leamington Spa
    • Posts: 19,081
    Re: Running certain code in codeblocks sets off AVG?
    (Original post by burgergetsbored)
    haha all it does is print to command line! I switched to avast a while back now and haven't had problems since, and avast gives you the option of carrying on executing if something is detected whereas AVG didn't. I'll try changing the code a little next time something comes up, cheers.
    Chances are a next time won't come up
Sign in to Reply
Share this discussion:  
Useful resources
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.