A C++ program that does simply
#include <Magick++.h>
fails to compile with g++ -std=c++11. I'm using GCC 4.9.0 on Linux x86 with GraphicsMagick 1.3.19.
This is because Magick++.h indirectly includes magick/common.h, which has
#if !defined(__attribute__)
# if (!defined(__GNUC__) || (__GNUC__ < 2 || __STRICT_ANSI__))
# define __attribute__(x) /*nothing*/
# endif
#else
(omitted)
#endif
It looks like the -std=c++11 flag causes GCC to define __STRICT_ANSI__, causing the above code to define __attribute__ as nothing. And this breaks some internal GCC headers (/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/include/x86intrin.h for me).
See also:
* http://sourceforge.net/p/graphicsmagick/mailman/message/31837298/
* http://stackoverflow.com/questions/22795033/linking-graphicsmagick-on-mac-osx-10-8-with-clang-and-libc
As a workaround, I'm doing
which gets around the problem.
The actual error is
and a huge number of similar ones.
Thanks for identifying the source of the problem. Apparently when I decided that defining attribute(x) to nothing was a good idea, I did not consider that it might be used in other header files.
Fixed by Mercurial changeset 14082:f837cdfd1544 and will appear in the next development snapshot.