0

I'm trying to use GraphicsMagick and got odd build errors, so I added #include <magick/magick.h> to

#include <stdio.h>
int main(int argc, char *argv[]){
    printf("hello magick");
    return 0;
}

just to see WTF was going on. Obviously hello_world compiles fine. Simply adding the magick header causes tons of errors compiling with any of the following:

  • clang or gcc -o test.o $(pkg-config --cflags --libs GraphicsMagick) test.c
  • clang or gcc -o test.o $(GraphicsMagick-config --cflags --libs) test.c

From clang:

zsh/2 1791 % clang -o test.o $(pkg-config --cflags --libs GraphicsMagick) test.c
In file included from test.c:2:
/usr/include/GraphicsMagick/magick/magick.h:19:9: error: unknown type name 'Image'
typedef Image
        ^
/usr/include/GraphicsMagick/magick/magick.h:20:28: error: unknown type name 'ImageInfo'
  *(*DecoderHandler)(const ImageInfo *,ExceptionInfo *);

The solution suggested by Mr. Hale (#1) works perfectly for the test. Trying in the real project; gcc spits thousands of line of errors like:

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include/f16cintrin.h: In function ‘__m128i mm256_cvtps_ph(__m256, int)’: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include/f16cintrin.h:73:66: error: cannot convert ‘__m256 {aka float}’ to ‘__vector(8) float’ for argument ‘1’ to ‘__vector(8) short int __builtin_ia32_vcvtps2ph256(__vector(8) float, int)’ return (__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf) __A, __I);

Since the only change from having the project build successfully and the above was uncommenting either one or both of the following:

#include <magick/api.h>
#include <magick/magick.h>

I'm quite sure I've got something wrong with the build settings. I'm not having success finding documentation on what particular restrictions GraphicsMagick places on compiler/linker options. Finding that might well solve the problem.

4

3 に答える 3

0

プロジェクト全体の CXXFLAGS での使用std=c++0xから変更により、問題が解決したようです。std=gnu++11何らかの理由で、graphicsmagick 1.3.18-3 はc/c++ API からは使用できないstd=c++0xようです。これが完全な説明や答えではないことはわかっていますが、物事を構築します。

于 2013-09-27T04:44:41.853 に答える