Virus Protection Software Blocking My Programs

So I was programming a calculator, this was the beginning of my code:

1
2
3
4
5
int main(){
    vector<double> emil;
    cout << "-= Emil's Calculator =-\n\nGive me your first number: "; cin >> emil[0];
    return(0);
}


It works fine, but as soon as I define the length of my vector, like this:

1
2
3
4
5
int main(){
    vector<double> emil(1);
    cout << "-= Emil's Calculator =-\n\nGive me your first number: "; cin >> emil[0];
    return(0);
}


the program won't run. My virus protection software says that it has discovered a threat and asks if I want to remove it or not. If I ignore, nothing happens, the console screen stays black and nothing gets written. If I tell it to remove the threat it loads for a few seconds, but still nothing gets written. And if I run the program again, the same thing happens all over again. What should I do? How do I tell the software, in this case AVG, to stop protecting me from this obviously harmless program of mine? And why does it fuck up as soon as I define the length of my vector?
I have read on this once I saw your question. Based on what I'm seeing, to make it a certain size you got to do this:

1
2
vector<double> emil;
emil.resize(1);  //resize makes it stay at a certain size that is requested within its field 


Hope this helps. I'm not much familiar with this too much.
Last edited on
Yeah, in some strange way that did the trick. It works now. I don't get why it didn't work before though...
Topic archived. No new replies allowed.