I have cygwin on windows through which I run gcc. But after creating .exe files, if I run them on other computers which dont have cygwin, it says cygwin1.dll not found. Is there a way to compile them so that they run on any system?
+4
A:
You need to compile for MinGW (Minimal GNU Win32) mode. You do that by either installing mingw instead of (or in addition to) cygwin, or by passing the --mno-cygwin compiler option to the cygwin gcc.
Martin v. Löwis
2009-09-25 06:23:41
But i m using fork function in my program. If I use -mno-cygwin, it says fork not defined.
avd
2009-09-25 06:27:10
Then you will have to provide cygwin1.dll to your users. Windows itself does not provide a fork() system call. It would be best to rewrite your code to not use fork anymore.
Martin v. Löwis
2009-09-25 07:43:35
+4
A:
In your case, try to copy cygwin1.dll as well (but it could depend on other DLLs as well) (of course you must comply with Cygwin's license with regards to distributing cygwin1.dll)
In cygwin, you can always check the needed 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
Amro
2009-09-25 06:32:08