How to write minimal program using GD library

Brian Dessent
Sat Jun 18 11:10:00 GMT 2005

Siegfried Heintze wrote:

> I cannot get it to work, however, with g++ or msvc v7. When I follow the

I very much doubt that you will be able to use Cygwin libraries with
MSVC, unless you know precisely what you're doing.

> directions with gcc, it compiles and links fine but when I try to run the
> resulting program, I get the following error:
> This application has failed to start because cygXpm-4.dll was not found.
> Re-installing the application may fix this problem.

This means that the DLL is either not installed or is not in the path. 
Windows has a specific search order for a needed DLL, which in most
cases means it must be in the same directory as the .exe or in the
PATH.  (Search MSDN for LoadLibrary for the details.)

The cygwin package search page at <> will
easily show you that this DLL is part of the xorg-x11-bin-dlls package
and that the DLL is installed into /usr/X11R6/bin.  If you have the
package installed then you need to ensure that /usr/bin and
/usr/X11R6/bin are both in the PATH.  If you run your program from a
bash prompt then this should already be the case, but if you try to run
the program outside of that you will need to add the paths (in Windows
form, not as /usr/bin) to your system PATH variable explicitly.

Note that because of this Windows requirement that a DLL be in the PATH
or the directory of the .exe, that the actual DLLs for libraries (e.g.
cygfoo.dll) are placed under /usr/bin, whereas the import libraries
(e.g. libfoo.dll.a) that are used for linking are placed in /usr/lib
which is where the compiler searches for libraries on a normal unix-like


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list