Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 839
VoroX Avatar asked Nov 21 '25 15:11

VoroX


1 Answers

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 :)

like image 158
VoroX Avatar answered Nov 23 '25 07:11

VoroX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!