While playing with the creation of a wrapper for a C++ library (OpenSceneGraph in this case). I am facing the following (it is like a file is not "seeing" a type defined beforehand).
I have created the following OpenSceneGraph repository.
When I compile nim cpp -r osg_ex I get the following error:
/home/jose/src/openscenegraph.nim/osg/Vec4us.nim(11, 26) Error: undeclared identifier: 'Vec4us'
So it complains about this line 11, because it uses Vec4us and it considers it is not declared.
But I start by importing osg.nim which contains Vec4us declaration and later it imports Vec4us. I have tried including it as well.
Why is it an undeclared identifier?
Because you named it Value_type.
type
Value_type* {.header: "Vec4us", importcpp: "osg::Vec4us::value_type".} = cushort
The issue is a misunderstanding on my side on how scope rules works.
I have to move the Vec4us declaration from osg.nim to a file that can be imported from those modules needing them.