尝试使用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示例,但它给出了相同的错误。也许我忘了添加任何库? os:win7 32,编译器:mingw32
UPD: 我删除了&#34; lib&#34;前缀到处都是,所以现在它看起来如此:
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
但我仍然有同样的错误