News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Including cairo easy

Started by joebanana, January 03, 2008, 06:43:46 PM

Previous topic - Next topic

joebanana

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


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)


rok@rok-desktop:~$ pkg-config --cflags --libs cairo
-I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12  -lcairo

thomas

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. :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."