Closed wv1124 closed 5 months ago
Please, update your installation before filling any bug.
(I have verified that my MSYS2 is up-to-date before submitting the report
)
- add E:\msys64\usr\bin, E:\msys64\ucrt64\bin to path.
Kind of a wild guess based on limited information, but if you put both on the PATH, you should put ucrt64\bin first. Otherwise you could be accidentally using eg msys binutils with ucrt64 gcc, and I'm sure that would be a recipe for disaster.
I had the same problem and the solution for me was a change in the Windows system environment variables.
In my case, only the path “C:\msys64\ucrt64\bin” and its position relative to the other system environment variables was relevant.
Meld, PuTTY, TortoiseGit and Git are installed on my computer and their paths were also entered in the environment variables.
At first I had entered the path “C:\msys64\ucrt64\bin” after the entries for Meld, PuTTY etc. and had the error described.
After I moved the path to MSYS2 to the top, i.e. before the paths of the other programs, compiling the source code worked without the error.
Description / Steps to reproduce the issue
win11
g++ .\main.cpp -o main
more refer: https://stackoverflow.com/questions/78477174/collect2-exe-error-ld-returned-116-exit-status-when-using-g-with-git-bash/78521930#78521930
g++ --version g++.exe (Rev6, Built by MSYS2 project) 13.2.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcc --version gcc.exe (Rev6, Built by MSYS2 project) 13.2.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Expected behavior
compile success
Actual behavior
collect2.exe: error: ld returned 116 exit status
Verification
Windows Version
MINGW64_NT-10.0-22631
Are you willing to submit a PR?
No response