[cairo] The first cairo program complie error

Tor Lillqvist tml at iki.fi
Thu Nov 1 18:29:01 PDT 2007


> cc -o hello `pkg-config --cflags --libs cairo` hello.c

Unlike Linux, for Windows (and Cygwin, which you seem to be using
here, and traditional Unix systems) you must specify the libraries
after object (or source) files. Object files (compiled from source
files if you enter source files on the command line) and libraries are
handled in the order specified. If you specify libraries before any
object (or source) files, no symbols are undefined and nothing will be
linked from the libraries.

Thus you must invoke pkg-config separately to get the compilation
flags and libraries:

cc -o hello `pkg-config --cflags cairo` hello.c `pkg-config --libs cairo`

--tml


More information about the cairo mailing list