Menu

#923 Trying to wrap a typedef enum

None
closed-out-of-date
nobody
python (260)
5
2021-12-29
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

  • Olly Betts

    Olly Betts - 2021-12-29
    • status: open --> closed-out-of-date
    • Group: -->
     
  • Olly Betts

    Olly Betts - 2021-12-29

    https://github.com/swig/swig/issues/2047 seems to be a report of the same issue, but in the bug tracker we now use, so closing this as a duplicate.

     

Log in to post a comment.