#923 Trying to wrap a typedef enum

open
nobody
python (259)
5
2012-12-21
2008-05-26
No

I am getting this weird error using swig :

/home/mmalaterre/Projects/gdcm/trunk/bin42/Wrapping/Python/gdcmPYTHON_wrap.cxx:
In function 'PyObject* _wrap_VR_IsValid__SWIG_1(PyObject*,
PyObject*)':
/home/mmalaterre/Projects/gdcm/trunk/bin42/Wrapping/Python/gdcmPYTHON_wrap.cxx:7638:
error: using typedef-name 'gdcm::VR::VRType' after 'enum'
/home/mmalaterre/Projects/gdcm/trunk/Source/DataStructureAndEncodingDefinition/gdcmVR.h:86:
error: 'gdcm::VR::VRType' has a previous declaration here
/home/mmalaterre/Projects/gdcm/trunk/bin42/Wrapping/Python/gdcmPYTHON_wrap.cxx:7638:
error: using typedef-name 'gdcm::VR::VRType' after 'enum'
/home/mmalaterre/Projects/gdcm/trunk/Source/DataStructureAndEncodingDefinition/gdcmVR.h:86:
error: 'gdcm::VR::VRType' has a previous declaration here
/home/mmalaterre/Projects/gdcm/trunk/bin42/Wrapping/Python/gdcmPYTHON_wrap.cxx:7638:
error: expected primary-expression before 'bool'
/home/mmalaterre/Projects/gdcm/trunk/bin42/Wrapping/Python/gdcmPYTHON_wrap.cxx:7638:
error: expected `)' before 'bool'

The line the compiler cannot digest is:

result = (bool)gdcm::VR::IsValid((char const *)arg1,(enum
gdcm::VR::VRType const &)*arg2);

and the C++ class is:

class VR
{
public:
typedef enum {
...
} VRType;
...
static bool IsValid(const char *vr1, const VRType &vr2);
...
};

Discussion