CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Jul 2012
    Posts
    7

    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:
    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. #2
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: Running certain code in codeblocks sets off AVG?

    I don't think that it has anything to do with your C++ coding. Are you sure your system is not infected with this Agent3.BMSZ?

    Please make a complete scan and see what you get out of your machine.

  3. #3
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: Running certain code in codeblocks sets off AVG?

    It happens sometimes when you write very simple programs. It is just a false positive from your anti virus program: Usually, just touching anything in your source and recompiling is enough.

    The problem also usually goes away good for once your program reaches about 15+ lines
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

  4. #4
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725

    Re: Running certain code in codeblocks sets off AVG?

    Also, try setting it up so that the executable created is not named "1.exe"

    A search of that filename brings up possible threats.

  5. #5
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Running certain code in codeblocks sets off AVG?

    Another remote possibility is that the string "BUST A MOVE" may be present in some known trojan or virus, and AVG is checking for it.

    Regards,

    Paul McKenzie

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Running certain code in codeblocks sets off AVG?

    Doesn't AVG let you flag certain files or directories as safe?

  7. #7
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Running certain code in codeblocks sets off AVG?

    Quote Originally Posted by Paul McKenzie View Post
    Another remote possibility is that the string "BUST A MOVE" may be present in some known trojan or virus, and AVG is checking for it.
    This is something I considered myself too but I was at least hoping that AV vendors stopped using this sort of test at least one decade ago. I remember sometime in the 90s when some relatively popular (EDIT: and completely benign) library of WordBASIC routines kept being mistaken for some virus named Hot just because it contained the string "This is hot!".

    Not actually impossible, though.
    Last edited by Eri523; July 5th, 2012 at 07:20 AM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  8. #8
    Join Date
    Jul 2012
    Posts
    7

    Re: Running certain code in codeblocks sets off AVG?

    1. a full antivurus, malware, spyware scan in both safe mode and normal windows indicates no problems.
    2. Changing the string text doesn't work.
    3. Changing the file name doesn't work.

    So I'm guessing I'll have to try another antivirus?

  9. #9
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: Running certain code in codeblocks sets off AVG?

    Quote Originally Posted by burgergetsbored View Post
    1. a full antivurus, malware, spyware scan in both safe mode and normal windows indicates no problems.
    2. Changing the string text doesn't work.
    3. Changing the file name doesn't work.

    So I'm guessing I'll have to try another antivirus?
    Why don't you just add your program to the safe list? The safe list is designed for these kinds of situations.
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

  10. #10
    Join Date
    Jul 2012
    Posts
    7

    Re: Running certain code in codeblocks sets off AVG?

    Quote Originally Posted by monarch_dodra View Post
    Why don't you just add your program to the safe list? The safe list is designed for these kinds of situations.
    I've literally just started so I'm just following small tutorials at the moment. So there are many different files! Surly there is an easier thing than doing this for every file I make?

  11. #11
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Running certain code in codeblocks sets off AVG?

    Quote Originally Posted by burgergetsbored View Post
    I've literally just started so I'm just following small tutorials at the moment. So there are many different files! Surly there is an easier thing than doing this for every file I make?
    First of all, the compiler and linker that produces your code is not CodeBlocks. The compiler and linker combination is the Gnu compiler and linker (g++, and ld). All CodeBlocks does is give you an integrated environment so you can run these tools.

    The g++ compiler is used by literally thousands of persons and companies around the world and on various hardware and operating systems. I highly doubt that there is any issue with the compiler and linker with AVG, since so many around the world use these tools and would have reported the issue. Maybe you have a virus or trojan on your system that attaches itself to your executables that you build.

    Regards,

    Paul McKenzie

  12. #12
    Join Date
    Jul 2012
    Posts
    7

    Re: Running certain code in codeblocks sets off AVG?

    Quote Originally Posted by Paul McKenzie View Post
    First of all, the compiler and linker that produces your code is not CodeBlocks. The compiler and linker combination is the Gnu compiler and linker (g++, and ld). All CodeBlocks does is give you an integrated environment so you can run these tools.

    The g++ compiler is used by literally thousands of persons and companies around the world and on various hardware and operating systems. I highly doubt that there is any issue with the compiler and linker with AVG, since so many around the world use these tools and would have reported the issue. Maybe you have a virus or trojan on your system that attaches itself to your executables that you build.

    Regards,

    Paul McKenzie
    Thanks for clearing that up for me. hmm that's weird then, I'll try running it on the computer in the other room which also has AVG on and see what I get from that. Someone on the same video said their anti virus was set off too but I guess there is a chance they're infected too. I'll do some research on the "trojan", see If I can do anything and get back to you!

  13. #13
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: Running certain code in codeblocks sets off AVG?

    Quote Originally Posted by burgergetsbored View Post
    I've literally just started so I'm just following small tutorials at the moment. So there are many different files! Surly there is an easier thing than doing this for every file I make?
    There are many different files that are involved in the construction of a final product, your "main.exe", or whatever your project is called. That's the only file AVG is having problems with, and the only file you need to add to the safe list.
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

  14. #14
    Join Date
    Jul 2012
    Posts
    7

    Re: Running certain code in codeblocks sets off AVG?

    Quote Originally Posted by monarch_dodra View Post
    There are many different files that are involved in the construction of a final product, your "main.exe", or whatever your project is called. That's the only file AVG is having problems with, and the only file you need to add to the safe list.
    If I were making only one big program that would be fine, but I'm working through many different tutorials at the moment so I have many different projects. Two out of the 7ish so far have set AVG off. But I can't be bothered to keep having to add programs to the safe list, I'd rather them just not be triggered at all! Wouldn't want to send it to someone for theirs to go off as well :/

  15. #15
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Running certain code in codeblocks sets off AVG?

    Upload the file to a couple of online virus scanners (google 'online virus scan') just to make sure you're not infected.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured