MagickWand API Compilation Error

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
jcasique

MagickWand API Compilation Error

Post by jcasique »

Hi, I trying to create a demo progam (using website contrast.c example), but I got this error during the compilation

"/usr/local/include/ImageMagick/magick/quantum.h", line 101.1: 1506-277 (S) Syntax error: possible missing ';' or ','?
"/usr/local/include/ImageMagick/magick/quantum.h", line 100.8: 1506-485 (S) Parameter declaration list is incompatible with declarator for inline.
"/usr/local/include/ImageMagick/magick/quantum.h", line 130.28: 1506-045 (S) Undeclared identifier quantum.

Any comments
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickWand API Compilation Error

Post by magick »

Did you use a command like this:
  • cc `MagickWand-config --cflags --cppflags` contrast.c `MagickWand-config --ldflags --libs`
Can you post which version of ImageMagick you are using and 10 or so lines around line 101 of quantum.h.

We tried contrast.c with ImageMagick 6.4.1 and it compiled without complaint.
jcasique

Re: MagickWand API Compilation Error

Post by jcasique »

I'm using IM 6.4.1

Here some lines from quantum.h

+67 typedef struct _QuantumInfo
+68 {
+69 unsigned long
+70 quantum;
+71
+72 QuantumFormatType
+73 format;
+74
+75 double
+76 minimum,
+77 maximum,
+78 scale;
+79
+80 size_t
+81 pad;
+82
+83 MagickBooleanType
+84 min_is_white,
+85 pack;
+86
+87 unsigned char
+88 *pixels;
+89
+90 size_t
+91 extent;
+92
+93 SemaphoreInfo
+94 *semaphore;
+95
+96 unsigned long
+97 signature;
+98 } QuantumInfo;
+99
+100 static inline Quantum RoundToQuantum(const MagickRealType value)
+101 {
+102 #if defined(MAGICKCORE_HDRI_SUPPORT)
+103 return((Quantum) value);
+104 #else
+105 if (value <= 0.0)
+106 return((Quantum) 0);
+107 if (value >= QuantumRange)
+108 return((Quantum) QuantumRange);
+109 return((Quantum) (value+0.5));
+110 #endif
+111 }

Using this command:
cc `MagickWand-config --cflags --cppflags` constrant.c `MagickWand-config --ldflags --libs`

I got the same error

"/usr/local/include/ImageMagick/magick/quantum.h", line 101.1: 1506-277 (S) Syntax error: possible missing ';' or ','?
"/usr/local/include/ImageMagick/magick/quantum.h", line 100.8: 1506-485 (S) Parameter declaration list is incompatible with declarator for inline.
"/usr/local/include/ImageMagick/magick/quantum.h", line 130.28: 1506-045 (S) Undeclared identifier quantum.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickWand API Compilation Error

Post by magick »

Seems you have a contrary compiler. What OS are you using? Which compiler? Which version? Change line 100 to
  • static inline unsigned short RoundToQuantum(const double value)
Does the compiler still complain? Does it complain for
  • static inline unsigned short RoundToQuantum(const float value)
Post Reply