1

尝试使用 VIPS 库构建项目。我将下一个 .lib 文件添加到项目中:

win32: LIBS += -L$$PWD/../../../../vips-dev-8.4/lib/ -llibvips

INCLUDEPATH += $$PWD/../../../../vips-dev-8.4/include
DEPENDPATH += $$PWD/../../../../vips-dev-8.4/include

win32: LIBS += -L$$PWD/../../../../vips-dev-8.4/lib/ -llibglib-2.0

INCLUDEPATH += $$PWD/../../../../vips-dev-8.4/include/glib-2.0
DEPENDPATH += $$PWD/../../../../vips-dev-8.4/include/glib-2.0

win32: LIBS += -L$$PWD/../../../../vips-dev-8.4/lib/ -llibvips-cpp

INCLUDEPATH += $$PWD/../../../../vips-dev-8.4/include
DEPENDPATH += $$PWD/../../../../vips-dev-8.4/include

win32: LIBS += -L$$PWD/../../../../vips-dev-8.4/lib/ -llibvipsCC

INCLUDEPATH += $$PWD/../../../../vips-dev-8.4/include
DEPENDPATH += $$PWD/../../../../vips-dev-8.4/include

这是我的 main.cpp(我从 vips 官方示例中复制了它)

#include <QCoreApplication>
#include <vips/vips.h>
#include <vips/vips8>
using namespace vips;
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

      GOptionContext *context;
      GOptionGroup *main_group;
      GError *error = NULL;

      if( VIPS_INIT( argv[0] ) )
        vips_error_exit( NULL );

      context = g_option_context_new( "" );

      main_group = g_option_group_new( NULL, NULL, NULL, NULL, NULL );
      g_option_context_set_main_group( context, main_group );
      g_option_context_add_group( context, vips_get_option_group() );

      if( !g_option_context_parse( context, &argc, &argv, &error ) ) {
        if( error ) {
          fprintf( stderr, "%s\n", error->message );
          g_error_free( error );
        }

        vips_error_exit( NULL );
      }

      VImage in = VImage::new_from_file( argv[1],
        VImage::option()->
          set( "access", VIPS_ACCESS_SEQUENTIAL_UNBUFFERED ) );

      double avg = in.avg();

      printf( "avg = %g\n", avg );
      printf( "width = %d\n", in.width() );


      VImage out = in.embed( 10, 10, 1000, 1000,
        VImage::option()->
          set( "extend", "background" )->
          set( "background", 128 ) );

      out.write_to_file( argv[2] );

      vips_shutdown();
    return a.exec();
}

它给出了下一个错误: 在此处输入图像描述

我也尝试编译 C 示例,但它给出了相同的错误。也许我忘了添加任何库?操作系统:win7 32,编译器:mingw32

UPD: 我到处都删除了“lib”前缀,所以现在看起来是这样的:

win32: LIBS += -L$$PWD/../../../../vips-dev-8.4/lib \
        -lvipsCC -lvips-cpp -lvips -lgsf-1 -lz -ljpeg -lxml2 -lfftw3 -lm \
        -lMagickWand-6.Q16 -llcms2 \
        -lopenslide  -lpangowin32-1.0 -ltiff -lpng16 -lexif \
        -lMagickCore-6.Q16 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 \
        -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl \


INCLUDEPATH += $$PWD/../../../../vips-dev-8.4/include
INCLUDEPATH += $$PWD/../../../../vips-dev-8.4/include/glib-2.0
INCLUDEPATH += $$PWD/../../../../vips-dev-8.4/include/glib-2.0/include

但我仍然有同样的错误

4

0 回答 0