Search code examples
c++cdllcygwin

cygwin1.dll is missing - Cannot run program


I wrote a program in C/C++ and compiled it using Cygwin. When I ran the compiled file, I receive an error about a missing library.


Solution

  • Cygwin is like a simple framework: With every program you build you have to include the library cygwin1.dll.

    Important note: Downloading the library online might be risky as it can be a virus.


    To fix the issue:
    1. Go to your cygwin directory. Usually that is C:\cygwin or C:\cygwin64. If you don't know where cygwin is, download the setup file and run it. The installation path the installer suggests is the Cygwin installation location.

    Tip: Don't use a directory to put cygwin in that includes spaces (" ") as it will be easier to run programs with command-line parameters.

    2. Copy the file. It should be in <Drive>:\cygwin\bin\cygwin1.dll.

    3. Copy the file to your program folder, the same directory as your exe file.

    Your program should run without throwing an exception.