VoroX
VoroX

Reputation: 247

Long execution time on simple C++ 'Hello World' program

A basic (and maybe stupid) question:

I just started learning C++ and as every first step in a new programming language I wrote a program to print out "Hello World":

#include <iostream>

using namespace std;

int main() 
{
    cout << "Hello World!\n";
    return 0;
}

For this I use the g++ compiler and the compilation finished quickly. However the execution time is very long (about 26 seconds according to my IDE).

Compile command I used (if it should be relevant): g++ main.cpp -o main

I looked up another guy executing the exact same code with (as far as I know) the exactly same conditions and it took him about 0.05 seconds (according to the output print of his IDE).

I'm pretty sure that something similar to this was already asked a lot of times but I couldn't find any useful information regarding this in about 2 hours of research (maybe looked at the wrong places?) so I think it's justified to ask.

Any information, an optimization or just some suggestions on where to search, is appreciated.

-VoroX

Upvotes: 3

Views: 1233

Answers (1)

VoroX
VoroX

Reputation: 247

So apparently the antivirus really was the problem, even thou I whitelisted my program, anyway if anyone else has a similar issue, and whilelisting won't help, try to disable your antivirus temporarily.

Thanks to Alan Birtles :)

Upvotes: 3

Related Questions