I've recently started using Msys2 to install gcc compiler to make some exe for Windows. It works very well, but there's a problem when passing my exe to my brother. His laptop has not msys2 installed and when he tries to run my exe some errors occur. Seems like few dll files are necessary to use my exe (like msys-2.0.dll).
I've found out that those files are used by msys2 to "fake" the OS on the machine pretending it's a POSIX one. Is there a way to compile standalone exe for windows with msys2? I would like my brother to be able to use my exe without installing msys or else.
Here are all the details to understand better my situation:
g++ HelloWord.cpp -o Hellowordis the line I use to compileC:\msys64\mingw64\binhere's the path where g++ is stored- All the exact error messages I receive from windows after double clicking on the exe file that has been generated. Note that these messages do not appear on the CMD, but in a classic Windows error pop-up:
- The program can't start because msys-2.0.dll is missing from your computer. Try reinstalling the program to fix this problem.
- The program can't start because libstdc++-6.dll is missing from your computer. Try reinstalling the program to fix this problem.
- The program can't start because libgcc_s_seh-1.dll is missing from your computer. Try reinstalling the program to fix this problem.
Fixed:
I've resolved the issue just using the g++ parameter -static. Is it an overkill?