0

I am trying to make a program, and have simplified the code down to the following, to show the part in which the bug lies:

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
    cout << "huh.\n";
    return 0;
}

For some reason, it builds like a charm, with no warnings or errors, but fails to run. After navigating to the exe's directory on command prompt, I run the program and it never prints out huh., and never quits. I have a feeling it is a problem with stdio.h, but I am not sure. Any help would be appreciated!

Note: Compiled with Microsoft Visual Studio 2015 for Windows Desktop.

Flare Cat
  • 591
  • 2
  • 12
  • 24
  • 2
    Does it work if you [flush](http://stackoverflow.com/q/15042849/3425536) the output with `endl`: `cout << "huh." << endl;`? Btw the `stdio.h` include is redundant. – Emil Laine Nov 23 '15 at 02:08
  • No, still doesn't work. I used stdio.h for another project, I just got rid of all the code that needed it. (So now it is just the bare-bones base.) – Flare Cat Nov 23 '15 at 02:15
  • I compiled your code as a *Win32 Console Application* with Visual Studio 2015. Works fine. – selbie Nov 23 '15 at 02:33
  • I did the same, and it didn't work on either of my computers. Any ideas? – Flare Cat Nov 23 '15 at 02:41
  • 1
    turn off your antivirus – M.M Nov 23 '15 at 02:42
  • 1
    Can you run it in the debugger and step-into and see where it gets? – M.M Nov 23 '15 at 02:42
  • Ohh, antivirus. I will try turning it off tomorrow. I'll report how it works. (I'm in my bed right now.) – Flare Cat Nov 23 '15 at 02:44
  • And in the debugger, it just stops at the step where it says *.sln -> *.exe, and displays Window's hour glass. (Sorry I can't remember locations of the files, so that is what the *s represent) – Flare Cat Nov 23 '15 at 02:48
  • It was my antivirus. It actually blocked the running of any program from VS 2015. I'll file a report. – Flare Cat Nov 23 '15 at 13:14

1 Answers1

0

So my issue was what M.M suggested, my antivirus(Avast). I believe it blocks the running of any code from VS 2015, so I'll make a report. I don't think it had anything to do with stdio.h.

Thanks to M.M!

Flare Cat
  • 591
  • 2
  • 12
  • 24