How can I fix the “ld returned 1 exit status” error in C++ on Windows?

0
0
Asked By VelvetMango42 On

I'm writing my first C++ program on Windows 11. The code only includes , prints two lines, and returns 0, so it seems valid. However, every time I compile it, I get this linker error:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/16.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/16.2.0/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 it was configured correctly or how the compiler and linker are being invoked. What should I check to resolve this?

1 Answer

Answered By CopperLark19 On

This turned out to be a Windows security setting rather than a problem with the program. Disabling Smart App Control under Windows Security > App & browser control allowed the linker plugin to load and fixed the build.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.