[cairo] using cairo in c++

John Taber jtaber at johntaber.net
Wed Oct 12 06:01:47 PDT 2005


Aha, turns out 'pkg-config' was the culprit

fltk configure uses 'pkg-config' to get the cairo lib paths and I had 
installed cairo from the tar source and I guess cairo "make install" 
does not update pkg-config as to where the cairo files are.  [Which 
would be handy to call out in the cairo installation page - btw when I'm 
done here I will do a section on using cairo with fltk]

Fltk compiled fine with cairo but now in my cairo test program I get 
undefined reference errors for my cairo commands - I guess I'm missing 
some header file

#include <fltk/x.h>

void draw() {
   snippet_normalize(fltk::cc, 200,200); //<=== snippet... undefined
   cairo_arc(fltk::cc, .5, .5, .4, 45.0, 180.0); //<=== cairo_arc undef
}

the fltk::cc context seems to be created and found.  I tried adding
#include <cairo.h>  but that created context conflicts with <x.h>


Bill Spitzak wrote:
> 
> 
> John Taber wrote:
> 
>> Thks for the info - but fltk 2.0.x-r4586 does not fully build with the
>> enabled-cairo option - (it fails on compiling Fluid with "libcairo.so.2
>> - cannot open shared object file ...)
>>
>> Following the partial build - I tried a helloworld program (without any
>> cairo commands) - fails on linking libfltk.a (fillrect.o) - undefined
>> reference to cairo_rectangle - so somehow it is using cairo in base 
>> fltk libs though those libs are apparently not correctly built.
>>
>> Not sure if this is related to cairo pkgs, fltk makefiles, fltk
>> namespaces, or even something else (btw compiled under gcc 3.3.5).  If 
>> its a pure Fltk issue, I'll move this over to the Fltk list.  I 
>> checked that both the fltk make and my make for helloworld linked to 
>> the /usr/lib directory - I noticed Cairo headers are in 
>> /usr/include/cairo
> 
> 
> Pretty certain this is an fltk issue.
> 
> It sounds like it is not locating the cairo library, probably because 
> the name/location is hardcoded into the makefile. The file "makeinclude" 
> is the configure output, you can probably edit that to change the -L 
> switches.
> 
> Note that this was last tried with a pre-1.0.0 version of cairo, though 
> somebody patched it for the new version, but I don't know if it ever 
> worked.
> 
> 



More information about the cairo mailing list