[cairo-commit] [cairo-www] src/FAQ.mdwn

Carl Worth cworth at freedesktop.org
Wed Nov 14 09:43:17 PST 2007


 src/FAQ.mdwn |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit ee4ae5576b38ae683dffa2b606e618a0e73c63cd
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Nov 14 09:48:28 2007 -0800

    Add more details about compiler flags and pkg-config

diff --git a/src/FAQ.mdwn b/src/FAQ.mdwn
index 4a6d7f8..d49a4b2 100644
--- a/src/FAQ.mdwn
+++ b/src/FAQ.mdwn
@@ -56,13 +56,27 @@ Create a file called `hello.c` containing
 
 <h2 id="compilation_flags">What compilation flags are required to compile that code?</h2>
 
-You can compile the above hello.c with: 
+You will need to instruct the compiler where to find the cairo.h file,
+(generally something like "-I /usr/include/cairo"), and tell the
+linker where to find the cairo library and to linke with it, (often
+something like "-L /usr/lib -lcairo").
+
+But the exact flags and paths will depend on your compiler and your
+installation of cairo. To simplify this, cairo uses pkg-config which
+can help you determine the correct flags to use. If you have
+pkg-config installed, then you can compile the above hello.c with:
     
-    cc -o hello `pkg-config --cflags --libs cairo` hello.c
+    cc -o hello $(pkg-config --cflags --libs cairo) hello.c
 
 and, after running the resulting `hello` program you'll have a PNG
 image file named `hw.png` with "Hello World" written in blue.
 
+NOTE: If cairo is not installed to a system directory that pkg-config
+is aware of, then you will need to tell pkg-config about the directory
+by setting the PKG_CONFIG_PATH environment variable to point to the
+directory into which cairo.pc is installed, (for example, with bash,
+"export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig").
+
 <h1 id="drawing_questions">Drawing questions</h1>
 
 <h2 id="clear_a_surface">How do I clear a surface?</h2>


More information about the cairo-commit mailing list