0

我需要旋转一个 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");
    }
}

生成文件包含

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 吗?

4

1 回答 1

1

Autotools 将仅使用 valac 将 Vala 代码转换为 C,然后将使用它对构建 C 的支持来实际编译为机器代码。这意味着您需要将相关信息添加到*_CFLAGS 和*_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)
于 2012-08-22T16:45:02.400 回答