Compiling with gcc (cygwin on windows)

前端 未结 5 2025
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-30 11:57

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 t

相关标签:
5条回答
  • 2020-12-30 12:08

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

    0 讨论(0)
  • 2020-12-30 12:18

    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.

    0 讨论(0)
  • 2020-12-30 12:23

    See the Cygwin FAQ.

    0 讨论(0)
  • 2020-12-30 12:25

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

    How do I compile a Win32 executable that doesn't use Cygwin?

    The compilers provided by the mingw-gcc, mingw64-i686-gcc, and mingw64-x86_64-gcc packages link against standard Microsoft DLLs instead of Cygwin. This is desirable for native Windows programs that don't need a UNIX emulation layer.

    This is not to be confused with 'MinGW' (Minimalist GNU for Windows), which is a completely separate effort.

    0 讨论(0)
  • 2020-12-30 12:29

    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

    0 讨论(0)
提交回复
热议问题