0

I'm writing in C. My code is simply this in main.c:

#include <stdio.h>
int main(void)
{
    printf ("Test\n");
    return 0;
}

However, anytime I try to run the program, it fails in two different ways. If I run without debugging, the console window appears like this without changing besides the '_' blinking.

If I run with debugging, whether or not I place a break point, Visual Studios freezes and I have to close it via task manager.

I've noted that it's only programs that I've written since I've had this bug that have this problem. Past projects before I've had this problem all work properly, as well as projects I download.

I've:

  1. Uninstalled, then reinstalled Visual Studio.
  2. Run the repair function via Control Panel.
  3. Tried creating several new projects, and let others create the projects to see if it's just something I'm doing wrong.
  4. Restarted my computer.

I'm on Windows 10.

EDIT: If I run from the Debug folder it still does not work similarly.

EDIT: Solved! Was a problem with Avast! Antivirus. See @blastfurnace 's comment.

DekuFox
  • 1
  • 1
  • 1
    Obvious question: What else changed at the same time the problem appeared? – Carey Gregory Nov 16 '15 at 05:04
  • I don't believe anything changed. I haven't installed any programs recently or anything. The only change I could think of is perhaps Windows Update changing something? – DekuFox Nov 16 '15 at 05:33
  • Just a guess here, but have you recently created or used any projects different from your current project which should be Win 32 / console app? If so, Visual Studio may be defaulting settings that create issues on your new project. You could also try compiling from the console windows, click on start / programs / visual studio ... / ... command prompt , change directory to where you have the source file, then use Cl /Od example.c to compile your program and try running it (like example.exe) and see if that works. – rcgldr Nov 16 '15 at 09:01
  • 1
    Do you use Avast antivirus? There have been several recent questions where Avast is causing this or similar problems. You can temporarily disable Avast to test. If that works you can add an exclusion for your "\Visual Studio 2012\Projects" folder, or get a better antivirus. – Blastfurnace Nov 16 '15 at 12:53
  • @Blastfurnace This worked, thank you very much! Now to get to coding for my assignment due Wednesday (that's been assigned for 2 weeks) OTL – DekuFox Nov 16 '15 at 20:13
  • Please always post the actual code, not some code that makes me give the wrong answer! – Iharob Al Asimi Nov 17 '15 at 01:38
  • @iharob There wasn't really any actual code, it was just a general issue I was having with all programs I wrote. – DekuFox Nov 18 '15 at 06:23

1 Answers1

0

Try resetting the VS settings .

Run devenv.exe /ResetSettings .

HRG
  • 182
  • 5
  • 16