views:

67

answers:

1

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?

+1  A: 

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

Michael Burr
+1 for copyright avoidance. That is a clever side effect of it already being on every Windows system. Programs built with MinGW require it, but never have to distribute it. Hence, no copyright issues.
RBerteig
Even if i Not use any std C functions in code it requires MSVCRT I think for CRT startup/cleanup codes that run before/after main. newlib provides that also?
zaharpopov