Compiling with gcc (cygwin on windows)

I have cygwin on the windows through which I run gcc. But after creating the .exe files, if I run them on other computers that do not have cygwin, he says that cygwin1.dll was not found. Is there a way to compile them so that they run on any system?

+6
gcc cygwin
source share
5 answers

In your case, try also copying the cygwin1.dll file (but this may depend on other DLLs) (of course, you must comply with the Cygwin license with respect to the distribution of cygwin1.dll)
In cygwin, you can always check the necessary modules using:

objdump -p a.exe | grep 'DLL Name' 

OR

 cygcheck ./a.exe 

or for windows in general, use something like this tool: Dependency Walker

+10
source share

You need to compile for MinGW mode (Minimal GNU Win32). You do this by installing mingw instead of (or in addition to) cygwin or by passing the -mno-cygwin compiler option to cygwin gcc.

+11
source share

You can try compiling with the -mno-cygwin command-line -mno-cygwin .

+4
source share
+1
source share

From http://cygwin.com/faq/faq.html#faq.programming.win32-no-cygwin

How to compile a Win32 executable that does not use Cygwin?

The compilers provided by the mingw-gcc, mingw64-i686-gcc, and mingw64-x86_64-gcc packages are mapped to the standard Microsoft libraries instead of Cygwin. This is desirable for native Windows programs that do not need the UNIX emulation layer.

This should not be confused with "MinGW" (Minimalist GNU for Windows), which is a completely separate endeavor.

0
source share

All Articles