Library link error when starting a Windows application compiled with MinGW on another computer

I wrote a simple console application HelloWorld and compiled it on Windows 7 using the MinGW compiler using one of the following commands:

gcc -Wall -pedantic Hello.c -o Hello.exe
g++ -Wall -pedantic Hello.cpp -o Hello.exe

However, the compiler associates some of its own dynamic libraries with the application, and when I copy the executable file to another Windows 7 computer that does not have MinGW installed, I get the missing library error. On Linux, this problem is solved by the package system, which automatically installs all the necessary libraries, but on Windows, of course, you do not want your users to install MinGW to run your program.

So my question is: how do I properly connect all the libraries and what else needs to be done to make the application run independently?

Although I believe that this should be a fundamental problem for all Windows programmers, I could not find answers on the Internet (maybe I just don’t know how and what to look for).

+4
source share
2 answers

This was in the FAQ at some point, but now I seem to find it only on this page :

Why am I getting an error in the libstdc ++ - 6.dll file when I start my program?

GCC4 libgcc libstd++ , libgcc_s_dw2-1.dll libstd++ - 6.dll GCC4 ( MinGW\bin). DLL , "-static-libgcc -static-libstd++" " " options " .

,

g++ -static-libgcc -static-libstdc++ -Wall -pedantic Hello.cpp -o Hello.exe
+2

, , , , MinGW. - , .

, , , , .exe.

, , , , . MinGW .

0

Source: https://habr.com/ru/post/1538171/


All Articles