如何修复“错误:gdk-pixbuf / gdk-pixdata.h:没有这样的文件或目录?”

时间:2012-08-22 14:13:46

标签: gtk vala gdk gdkpixbuf

我需要旋转一个Pixbuf。 vala代码包含

using Gst, GLib, Posix, Sqlite, Gdk;
public class RotateSaveImage
{
    public void RotateSaveImage(string input, string output)
    {
        var img = new Pixbuf.from_file(input);
        var rotate_image = img.rotate_simple(PixbufRotation.CLOCKWISE);
        rotate_image.save(output, "jpeg");
    }
}

makefile包含

  

test_VALAFLAGS = --vapidir = @ VAPIDIR @ --pkg gstreamer-0.10 --pkg   glib-2.0 --pkg gio-2.0 --pkg posix --thread --pkg gstreamer-app-0.10   --pkg sqlite3 --pkg gtk + -3.0

不应该--pkg gtk + -3.0添加gdk-pixbuf / gdk-pixdata.h?

1 个答案:

答案 0 :(得分:1)

Autotools将使用valac将Vala代码转换为C,然后使用它支持构建C以实际编译为机器代码。这意味着您需要将相关信息添加到* _CFLAGS ans * _LDFLAGS。通常,这可以通过在configure.ac中添加类似的内容来完成:

PKG_CHECK_MODULES(GIO_PIXBUF, gio-2.0)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10)
AC_SUBST(GSTREAMER_CFLAGS)
AC_SUBST(GSTREAMER_LIBS)
PKG_CHECK_MODULES(GSTREAMER_APP, gstreamer-app-0.10)
AC_SUBST(GSTREAMER_APP_CFLAGS)
AC_SUBST(GSTREAMER_APP_LIBS)
PKG_CHECK_MODULES(SQLITE, sqlite3)
AC_SUBST(SQLITE_CFLAGS)
AC_SUBST(SQLITE_LIBS)
PKG_CHECK_MODULES(GTK, gtk+-3.0)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

Makefile.am中的类似内容:

test_VALAFLAGS = --vapidir=@VAPIDIR@ --pkg gstreamer-0.10 --pkg glib-2.0 --pkg gio-2.0 --pkg posix --thread --pkg gstreamer-app-0.10 --pkg sqlite3 --pkg gtk+-3.0

test_CFLAGS = $(GIO_CFLAGS) $(GSTREAMER_CFLAGS) $(GSTREAMER_APP_CFLAGS) $(SQLITE_CFLAGS) $(GTK_CFLAGS)

test_LDFLAGS = $(GIO_LIBS) $(GSTREAMER_LIBS) $(GSTREAMER_APP_LIBS) $(SQLITE_LIBS) $(GTK_LIBS)