I'm writing my first C++ program on Windows 11. The code only includes , prints two messages, and returns 0, so it seems valid. However, every time I compile it, I get this linker error: "ld.exe: .../liblto_plugin.dll: error loading plugin: collect2.exe: error: ld returned 1 exit status." I installed the compiler by following a tutorial, but I'm not sure whether my compiler or linker configuration is correct. What should I check, and what does this error mean?
2 Answers
The C++ code itself looks fine. The line about collect2.exe is only the final summary, so the important part is the earlier error message. In this case, the linker specifically says it could not load liblto_plugin.dll, which points to a compiler installation, environment, or Windows security issue rather than a problem with the program. It would also help to know the exact command you’re using to compile it and which toolchain is installed.
This can happen when Windows security blocks one of the compiler’s DLL files. The issue was resolved by disabling Smart App Control under Windows Security → App & browser control, allowing the linker plugin to load. Be careful when changing security settings, though—ideally confirm that the compiler came from a trusted source, and consider repairing or reinstalling the toolchain if possible.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically