Problems running code for the first time in VS2015 on Windows 10

I am having trouble getting started with C++ on Windows 10. I have used C++ before on Windows 8.1, with both the Geany and Visual Studio IDEs. I am struggling to work out if my problem is with what I'm doing or with Windows 10 itself, so I have tried to take as standard approach as possible to recreating my problem. The process is therefore from the cplusplus.com tutorial at http://www.cplusplus.com/doc/tutorial/introduction/visualstudio/

I have installed Visual Studio Community 2015. I have installed Visual C++ support from within the application. I have then started a C++ console application, ticking 'empty project', and made one file.

1
2
3
4
5
6
7
8
//example.cpp

#include <iostream>

int main() {
	std::cout << "(Hello world!)" << std::endl;
	return 0;
}


Then, I have pressed Ctrl+F5 to compile and run. The build is successful and a command prompt opens. The command prompt is however blank except for a blinking cursor. Ctrl+C does nothing. The window can be closed with no trouble. While the window is open, rebuilding fails because the .exe is in use.

If I run from command prompt I get the same behaviour - a blank new line with a cursor.

Has anyone had similar problems before, or since the Threshold 2 update to Windows 10 which I recently received? I find when I make new projects in Geany, the same thing happens. Can anyone advise me on what approach I should take to get back in business with C++?
I have been using TDM GCC on Windows 10 with success. It even comes with built-in OpenMP support!
http://tdm-gcc.tdragon.net/
I will give it a go and feed back, but given that the problem persists across two other IDEs, I don't think it's a problem specific to what IDE I use.

Update: TDM GCC compiles just fine, just like the others. And just like the others, executable does not run.
Last edited on
Maybe your antivirus program is blocking it. For example see this thread:
http://www.cplusplus.com/forum/windows/181823/#msg892176
Last edited on
I also suspect antivirus. I had trouble when avast kept deleting ld.exe without even asking first! Since then I have just added my compiler directory and *\a.exe to the ignore list. So, hopefully nobody drops a virus named a.exe to me.
@kevin
agree, just to add that avast is a crap and it's on top list of causing BSOD too.
@codekiddy
I agree with what you say too. The list that MVPS gives out to block advertising sites seems to cut down on any bad URLs coming my way. I did not have that when I first started using avast several years ago. With peerblock also being used, maybe now I could just ditch antivirus protection entirely.
http://winhelp2002.mvps.org/hosts.htm
Bingo, right on the money. Thank you Chervil, Kevin, it was indeed Avast. Disabling Avast shields for one minute let me run them, so I guess Avast was just stopping Windows from accessing the file to run, which is why there was no error or output of any kind.

Now to decide which is least annoying: adding every newly compiled executable to the exclusions or finding and installing different antivirus software...

Update: In fact, I didn't have to make that decision, I had to update the Avast software to the latest version and hey presto, everything works as it should. Thanks for your help, folks.
Last edited on
Topic archived. No new replies allowed.