Weird...

I was playing with CodeBlocks and ran this,but suddenly Kaspersky(anti-virus) detected my debug file as a Trojan "Trojan.Win32.Agent.vxrx".Where's the problem, is it the code?,IDE?
PS
I know I inserted the "c" without reason and that "b!=c" should be "b!=a,and although i corrected it, it's still viewed as Trojan by Anti-virus.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>

int main()
{
  int a,b,c;
  b=0;
  std::cout << "Type in the number:";
  std::cin >> a;

 while(b!=c){
  b++;

 }

std::cout << "The number is:" << b;




return 0;
}
Happened to me too once. Dunno why, but it it completely harmless, atleast what I know of ;)
Maybe,But then my PC started bugging and I couldn't open any .exe.Don't get me wrong,I keep my PC clean, full scan every now and then,it must be the code,I just don't understand what makes it act like a Trojan.
I'm a beginner just like you, my knowledge is by far worse than others here on this forum.

But if I should make a guess, I think it's a problem with your 'while' statement somehow.
That's quite strange, I have never encountered any problem with CodeBlocks so far. Maybe you can mark it as save or add it to a so called "Ignored Items" list in your AV. Hope this will solve the problem.
closed account (LAM21hU5)
dunno, but when I remove the std:: it says me "cout and cin were not declared in this scope which is strange because i have opened the iostream library. When I open the code and enter a number, it closes my console after a while. This isn't normal because I use codeblocks 11.05 and it automatically uses System ("Pause") at the end of program. Super strange. I thing that while(b!=c) should not start up the antivirus because I used it lots of times and no antivirus.
closed account (LAM21hU5)
My antivirus did not open up. I do not use Kaspersky. I prefer Symantec Endpoint Protection. Maybe it is because your antivirus might be more sensitive.
Its not that your code is being seen as a virus, Code::Blocks uses MinGW to emulate a Unix environment so that GCC can run and compile your code. Some times the anti-virus software will see this emulation as an attempt to attack your program that is being emulated by MinGW after it has been compiled. As to why your PC started bugging out could be many reasons, but I know that some anti-virus programs see MinGW as an attacker sometimes, specifically the free version AVG has this problem a lot.

Also your while(b!=c) doesn't make any sense because you never initialize c to have any value so the program will just run for a random amount of time

edit: also you're having the problem using cin and cout without the std:: even with #include <iostream> because you don't have a using namespace std; statement before your main function.
Last edited on
Topic archived. No new replies allowed.