0

Scenario: I hadn't been coding at home in a while and wanted to kick off my first server client application in C++ using the Visual Studio 2012 Express. But when I clicked the run button, VS froze. There was nothing wrong with the code, so I think the problem lies in some VS settings I'm unaware of, or I accidently downloaded an update which made things worse.

Issue: Hitting the play button (Debug Win32 selected) freezes the VS. Also the taskmanager gets 3 processes of the running program (none which I can interact with). Those processes cannot be terminated unless I reboot the computer.

Specs: Visual Studio 2012 Express, Windows 7, 64 bit. Avast Premier 2015.

#include <iostream>

int main() {
    printf("tilt");
    return 0;
}

Self-Debugging: I tried making new Hello World programs in new projects, but the issue was still there. If I opened an old project I knew worked before, it also had the same issue without me modifying anything. I changed to C# but still I couldn't run a simple program. I repaired my VS. I installed Visual Studio 2015 Community, but still cannot run any programs.

Error messages:

the process cannot access the file because it is being used by another process

visual studio could not copy exceeded retry count of 10. failed

Microsoft.Common.targets(3390,5)

Linker Tools Error LNK4098

error LNK1168: cannot open tiltTest.exe for writing

error LNK1181: cannot open input file 'kernel32.lib' //after repairing VS

Related links:

Visual Studio Hangs in debug?

Visual Studio 2015 freezes when debugging a cpp code

Windows Forms application remains alive in task manager after hitting "stop debugging" button

Visual Studio "Could not copy" .... during build

Resolving LNK4098: defaultlib 'MSVCRT' conflicts with

visual studio linker warning LNK4098

http://www.bytemedev.com/how-to-fix-visual-studio-error-the-process-cannot-access-the-file-because-it-is-being-used-by-another-process/

Final Words: I'm really bad at linking, settings, libs and anything that isn't code. So if you know how to solve it using those, please expect me to be really beginner as all that is totally confusing and illogical to me. Help would be really appreciated ! If the solution is found, I will modify this post so others will find the solution as well.

Solution: I reinstalled the Visual Studio and turned off Avast, which solved my problems! Thanks for suggestions!

Community
  • 1
  • 1

1 Answers1

2

Given the error message about another process using the file it could be down to the antivirus software trying to scan the files at the same time that Visual Studio is trying to access them.

I'd try turning off Avast (or any other anti virus) first. (If you're paranoid about viruses disconnect the computer from the internet).

If everything now works add an exclusion to the AV of your source folders so that it doesn't scan your code - after all you know that there are not going to be any viruses in the executables you create (right?). This will also have the added benefit of speeding up your compiles/links as the AV isn't checking the (potentially) 100's of files you could be modifying each time you build.

ChrisF
  • 127,439
  • 29
  • 243
  • 315