I have C program I compile with mingw
on Windows. It works fine but requires MSVCRT.DLL
. I want to link that statically (like I can do in Visual Studio). Is this possible?
I tried -static
flag to gcc
and it didn't make any change.
What about C++ program using also standard C++ library?
I believe that MinGW doesn't use the static runtime library for copyright reasons.
You can maybe try to use newlib ( http://sourceware.org/newlib/ ) to create an executable that doesn't link to msvcrt.dll
Having spent a while searching for this myself, I came across this post introducing the in-progress Mingw32 Alternate C Runtime Library . However, it's not ready for use, and the developer appears to have abandoned it. Home page link here .
Posting this answer here in the hope that it'll come in useful to people googling at some point in future.
链接gcc -static -static-libgcc -static-libstdc++
,你不需要libgcc_s_dw2-1.dll
和libstdc++-6.dll
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.