[Help] VS Code C++ .exe blocked by Device Guard – will Windows Defender exclusion fix this?

Posted by Significant_Tie_7440@reddit | learnprogramming | View on Reddit | 5 comments

Hey everyone,

I’m trying to run a simple C++ program in VS Code using g++, but every time I compile and run, I get this error:

'...practice.exe' was blocked by your organization's Device Guard policy.

I found some suggestions saying to add my programming folder as an exclusion in Windows Defender (Virus & threat protection → Exclusions).

My questions:

For context, I’m on Windows (not sure if it’s managed or just strict security settings).

If this won’t work, what’s the best alternative? (WSL, different IDE, etc.)

Thanks!