I am creating a project using mingw under windows. When run on another PC (without wingw in PATH, respectively), get errors, missing: libwinpthread-1.dll, libgcc_s_seh-1.dll, libstdc -6.dll. How can I build the project so that everything starts up normally?
CodePudding user response:
A C program needs runtime libraries to run. They're usually not part of the program itself! So you'd need to ship these libraries alongside with your program (which is what most software does).
You can, for many things, however, also use "static linking", which means that the parts of the libraries used by your program are included in your program itself! The -static
flag supplied to executable-generating step in your project will do that. If your program consists of but a single file, that would be g -o test -static test.c
(your g
might be called x86_64-w64-mingw32-g
or so).