I was able to pinpoint the problem, although I do not understand what causes it.
I have a file hierarchy like this,
toplevel
|-- setup.py
|-- ...
`-- pymch/
|-- __init__.py
|-- __init__.pxd
|-- ...
(.pxd and .pyx files for interfacing with python)
`-- mch/ (.pxd files for binding the C++ code)
|-- __init__.pxd
|-- ...
`-- shape/
|-- __init__.pxd
|-- convex.pxd
|-- convex_shape_definition.pxd
`-- ...
Here is how `convex_shape_definition.pxd` looks like,
cimport pymch.mch.clam as clam
cdef extern from "MCH/shape/convex_shape_definition.h" namespace "MCH::shape":
cdef cppclass Convex
cdef cppclass ConvexShapeDefinition:
ConvexShapeDefinition()
ConvexShapeDefinition(const ConvexShapeDefinition&)
clam.Vec3[double] pos_;
clam.Quat[double] rot_;
double size_;
const Convex* shape_;
If I don't cimport convex_shape_definition in convex.pxd, then I don't get any errors. Also, if I don't cimport clam above (and comment out the pos_, and rot_ declarations), but do cimport convex_shape_definition in convex.pxd, I also don't get any errors.
Here are the imports of convex.pxd,
from pymch.mch.shape.convex_shape_definition cimport ConvexShapeDefinition
from pymch.mch.clam.Vec3 cimport Vec3
from libcpp.vector cimport vector
I hope this helps solve the problem.