Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: joebanana on January 03, 2008, 06:43:46 pm

Title: Including cairo easy
Post by: joebanana on January 03, 2008, 06:43:46 pm
I am new to programming so please tell me what must I do so I can use cairo.h. I can compile in command line with this

Code
cc -o hello $(pkg-config --cflags --libs cairo) hello.c

But for my biger project i am using codeblocks and I need to include cairo. Also the output from pkg-config. (I dont know if it helps)

Code
rok@rok-desktop:~$ pkg-config --cflags --libs cairo
-I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12  -lcairo
Title: Re: Including cairo easy
Post by: thomas on January 03, 2008, 08:04:09 pm
You can add those include paths (-I) to your project's include paths manually, or you can copy the output of pkg-config to "other compiler options" (not portable, but works for you). It's the very same thing. It's not pretty and not portable, but it will work.

Alternatively (portable), you should be able to directly run pkg-config via backticks in "other compiler options". This will put the correct options onto the commandline, no matter where you run it later.
Try putting `pkg-config --cflags --libs cairo` into the field "other compiler options" in the project's option panel. Note that you need to use `, not ', nor ", nor anything else that looks similar. :)