Author Topic: Including cairo easy  (Read 6262 times)

joebanana

  • Guest
Including cairo easy
« 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
« Last Edit: January 03, 2008, 07:17:50 pm by joebanana »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Including cairo easy
« Reply #1 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. :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."