I recently got an HP Victus with an i7 13th Gen CPU, 24GB of RAM, and a 1TB SSD, so I expected everything to be super fast. I'm trying to set up VS Code for C programming with GCC/MinGW. I wrote a simple program that just reverses a word using arrays, and it shouldn't be complex at all. However, when I try to run it, VS Code takes over 400 seconds to execute (if it doesn't freeze or crash with exit code=1). I've already tried a bunch of things, including uninstalling Code Runner, moving my files out of OneDrive, running VS Code as admin, using both Command Prompt and PowerShell, compiling directly from the terminal instead of using the Run button, cleaning up tasks.json, and double-checking my code. Despite all that, the problem persists. It's clearly not a hardware issue since the laptop is new and high-spec. I'm hoping someone here has experienced a similar problem and knows what might fix it because I'm tired of this wait time.
5 Answers
Watch out for antivirus software—sometimes it can cause really slow compilation times because it scans files as they’re opened. It’s unlikely to explain why command line runs fine, but it’s worth checking if you have any such software installed.
Double-check where your compiler is installed. If it's still in OneDrive, move it out. That could significantly impact performance.
Have you tried running your code directly from the terminal? It's usually a good way to see if the issue is with VS Code itself or your setup. If it runs instantly there, then VS Code might be the culprit.
Yeah, it runs perfectly from the terminal, no issues at all. It’s only when I hit the Run button in VS Code that it lags.
What version of VS Code are you using? Sometimes issues arise from the Insiders build. Make sure you’re on the stable version.
I'm using the normal version of VS Code, not the Insiders build.
If you're running into a lot of issues with GCC on Windows, I recommend trying WSL2 (Windows Subsystem for Linux). It's often a smoother setup for C programs. Or, you might find MSVC in Visual Studio Community Edition to be a better experience over GCC in VS Code.
I already moved everything out of OneDrive, so that shouldn't be causing the delay.