Page 1 of 1
error C2065: 'Quantum': undeclared identifier
Posted: 2017-08-09T21:42:19-07:00
by Zeranoe
When compiling this:
Code: Select all
#include <iostream>
#include "Magick++.h"
int main()
{
std::cout << QuantumRange << std::endl;
}
I get:
Code: Select all
error C2065: 'Quantum': undeclared identifier
This appears to be a namespace issue. I thought it might be in the MagickCore namespace, but that didn't work either.
Re: error C2065: 'Quantum': undeclared identifier
Posted: 2017-08-10T03:47:44-07:00
by snibgo
Your program compiles, builds and runs successfully for me. (Gnu C, Cygwin, Windows 8.1.)
I know almost nothing about build environments. For those that do, it might help if you said what version IM, on what platform, using what toolchain.
Re: error C2065: 'Quantum': undeclared identifier
Posted: 2017-08-10T06:10:28-07:00
by Zeranoe
I'm using MSVC 2017 and compiled with:
Code: Select all
cl "/IC:\Program Files\ImageMagick-7.0.6-Q16\include" bug.cc
The error is two lines:
Code: Select all
bug.cc(6): error C2065: 'Quantum': undeclared identifier
bug.cc(6): error C2059: syntax error: 'constant'
I can reproduce this same bug in Ubuntu 17.04 with:
Code: Select all
g++ -I/usr/include/ImageMagick-6 -I/usr/include/x86_64-linux-gnu/ImageMagick-6 bug.cc
Code: Select all
In file included from /usr/include/ImageMagick-6/Magick++/Include.h:14:0,
from /usr/include/ImageMagick-6/Magick++.h:10,
from bug.cc:2:
/usr/include/ImageMagick-6/magick/magick-config.h:29:3: warning: #warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default" [-Wcpp]
# warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
^~~~~~~
/usr/include/ImageMagick-6/magick/magick-config.h:30:3: warning: #warning "this is an obsolete behavior please fix your makefile" [-Wcpp]
# warning "this is an obsolete behavior please fix your makefile"
^~~~~~~
/usr/include/ImageMagick-6/magick/magick-config.h:52:3: warning: #warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default" [-Wcpp]
# warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
^~~~~~~
/usr/include/ImageMagick-6/magick/magick-config.h:53:3: warning: #warning "this is an obsolete behavior please fix yours makefile" [-Wcpp]
# warning "this is an obsolete behavior please fix yours makefile"
^~~~~~~
In file included from /usr/include/ImageMagick-6/magick/MagickCore.h:76:0,
from /usr/include/ImageMagick-6/Magick++/Include.h:42,
from /usr/include/ImageMagick-6/Magick++.h:10,
from bug.cc:2:
bug.cc: In function ‘int main()’:
/usr/include/ImageMagick-6/magick/magick-type.h:94:25: error: ‘Quantum’ was not declared in this scope
#define QuantumRange ((Quantum) 65535)
^
bug.cc:6:16: note: in expansion of macro ‘QuantumRange’
std::cout << QuantumRange << std::endl;
^~~~~~~~~~~~
/usr/include/ImageMagick-6/magick/magick-type.h:94:25: note: suggested alternatives:
#define QuantumRange ((Quantum) 65535)
^
bug.cc:6:16: note: in expansion of macro ‘QuantumRange’
std::cout << QuantumRange << std::endl;
^~~~~~~~~~~~
/usr/include/ImageMagick-6/magick/magick-type.h:93:24: note: ‘MagickCore::Quantum’
typedef unsigned short Quantum;
^~~~~~~
/usr/include/ImageMagick-6/magick/magick-type.h:93:24: note: ‘MagickCore::Quantum’
/usr/include/ImageMagick-6/magick/magick-type.h:94:34: error: expected ‘)’ before numeric constant
#define QuantumRange ((Quantum) 65535)
^
bug.cc:6:16: note: in expansion of macro ‘QuantumRange’
std::cout << QuantumRange << std::endl;
^~~~~~~~~~~~