Re: Trouble with create_cairo_context



Mark Tilford wrote:
On Sun, Sep 28, 2008 at 7:43 PM, Jonathon Jongsma
<jonathon quotidian org> wrote:
Mark Tilford wrote:
On Sat, Sep 27, 2008 at 1:55 PM, Mark Tilford <ralphmerridew gmail com>
wrote:
Anybody ever figure out what caused this problem?  I can't get the
clock example to work:

~/src/gtk/clock$ g++ `pkg-config --cflags --libs gtkmm-2.4`
`pkg-config --cflags --libs cairomm-1.0` -g clock.cc main.cc
~/src/gtk/clock$ ./a.out
./a.out: symbol lookup error: ./a.out: undefined symbol:
_ZN3Gdk8Drawable20create_cairo_contextEv

I found a workaround:
Instead of
m_cairo_context = widget.get_window()->create_cairo_context();
Use
m_cairo_context = Cairo::RefPtr<Cairo::Context>(new
Cairo::Context(gdk_cairo_create(widget.get_window()->gobj())));

In case anybody else runs into the same problem.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
You're probably trying to link against a too-old version of gtkmm (?)  I
believe the gdk_cairo_create() function was added in GTK+ 2.6, but it wasn't
wrapped until the next release of gtkmm (due to the fact that cairomm wasn't
yet stable in time for gtkmm-2.6)

* I might not have the version numbers exactly correct, but I know for sure
that there was a 1-version gap between when cairo support was added to GTK+
and when it was added to gtkmm.

--
jonner



Exactly which version do I have / which file do I need to upgrade?
(gtkmm numbering has me completely confused.)

ii  libgtkmm-2.4-1c2a           1:2.12.5-2                  C++
wrappers for GTK+ 2.4 (shared libraries)
ii  libgtkmm-2.4-dev            1:2.12.5-2                  C++
wrappers for GTK+ 2.4 (development files)
ii  libgtkmm-2.4-doc            1:2.12.5-2                  C++
wrappers for GTK+ 2.4 (documentation)
ii  libcairomm-1.0-1            1.4.2-1                     C++
wrappers for Cairo (shared libraries)
ii  libcairomm-1.0-dev          1.4.2-1                     C++
wrappers for Cairo (development files)
ii  libcairomm-1.0-doc          1.4.2-1                     C++
wrappers for Cairo (documentation)

Those versions should all be plenty new. I just double-checked and create_cairo_context() was added in gtkmm 2.10 and you have 2.12 (you can be more sure about what version you're linking against by running `pkg-config --modversion gtkmm-2.4`)

btw, the second pkg-config invocation (the one for cairomm-1.0) is not necessary since gtkmm will pull that in automatically.

Also, I just noticed that this error is not occurring at link time, but instead at runtime. that seems very strange... maybe your environment is broken and you need to set LD_LIBRARY_PATH or something?

(also, I'm copying this message back to gtkmm-list. you're more likely to get good advice if you keep it on-list so other people can chime in)
--
jonner


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]