Visual Studio freezes after compiling. So does Explorer when I try to launch the application


My simple code:

#include <stdio.h>
int main()
   return 0;

After being successfully built by Visual Studio, it hangs when it tries to launch the .exe of the newly built program.

What I get is a "Generating code... code generated successfully" here it displays the path for example "project/test/debug/test.exe" And then it freezes. I get a loading icon forever, and if I click it disappears and I cant interact with Visual Studio anymore.

Launching the app from Windows would either hang the open folder and freeze it in place or load for a few seconds but with no result.

  • I have tried both with Visual Studio 2015 and Visual Studio 2013.

  • I have disabled C++ optimizations. I am using the correct project

  • I have no anti-virus.

  • I have disabled firewall.

  • I have disabled Windows Defender.

  • I am using Win8.1, and I am on a laptop.

  • I have disabled Windows SmartScreen and any other monitoring programs.

  • I have full ownership to the folder as I have changed the owner from System or TrustedInstaller to my username.

  • I have tried running Visual Studio as admin.

  • I have tried running the debug exe file as admin too.

  • I have an i5 Intel CPU, 8GB RAM, most of which is free. I also have 2 GPUs.

  • I have tried reinstalling Visual Studio.

    All other applications and games work flawlessly. I am getting some errors in Event Viewer:

Activation of app 21195DiogoCastro.MetroTasks_waqtkecxwwjbg!App failed with error:
Unknown HResult Error code: 0x80131515 See the
Microsoft-Windows-TWinUI/Operational log for additional information." and "Failure to load the application settings for package
microsoft.windowscommunicationsapps_8wekyb3d8bbwe. Error Code: 5".

  • I have disabled UAC.

Seems like maybe Windows is trying to start the exe via some Metro app or something, I don't know anymore.

asked on Stack Overflow Jan 23, 2016 by Eduard G • edited Jun 20, 2020 by Community

2 Answers


It worked in Safe Mode.

I began overruling services and processes one by one. Suddenly I stumbled upon a process called "Avast Antivirus". While I have Avast installed, I've removed it from Startup and rarely run it. I was naive to think that simply removing an anti-virus from Startup would tame it.

I couldn't end the process, so I ran avast and disabled the shields from inside the program, after which I was able to execute my code and everything worked fine.

Even while running, Avast wouldn't give me ANY warning that it's blocking my script and Visual Studio's Debug Mode, even tho it's not running in Gaming/Silent mode.

Further research shows that possibly the Avast process can be removed from startup using the Task Scheduler, I am not going to bother tho.

answered on Stack Overflow Jan 24, 2016 by Eduard G

When I compile your code I get: Error C1010 unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?. When I commented out the #include <stdio.h> and added "stdafx.h" it compiled and ran okay. This is under Windows 7, VS 2015 Update 1.

answered on Stack Overflow Jan 23, 2016 by J. Toran

User contributions licensed under CC BY-SA 3.0