STEPCAFControl_Writer compile error: ‘NCollection_Vector’ does not name a type

Hello,

I am trying to use STEPCAFControl_Writer to write a document as a step file. When I compiled the program, cmake outputs the following error:

$ cmake --build .
Scanning dependencies of target splitStep
[ 25%] Building CXX object CMakeFiles/splitStep.dir/testArea/splitStep.cpp.o
In file included from /home/kaiwen/ompl-assembly-planner/testArea/splitStep.cpp:2:
/usr/include/opencascade/STEPCAFControl_Writer.hxx:236:3: error: ‘NCollection_Vector’ does not name a type; did you mean ‘NCollection_Vec4’?
  236 |   NCollection_Vector<Handle(StepRepr_RepresentationItem)> myGDTAnnotations;
      |   ^~~~~~~~~~~~~~~~~~
      |   NCollection_Vec4
make[2]: *** [CMakeFiles/splitStep.dir/build.make:63: CMakeFiles/splitStep.dir/testArea/splitStep.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/splitStep.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I changed the NCollection_Vector to NCollection_Vec4 as the error suggested and then it compiled. The program also manages to write the step file, but then crashes, causing a segmentation fault (core dumped). I assume this is not a valid fix, but I am clueless how to fix it otherwise.

Any help is greatly appreciated. Thank you!

Here is the Terminal output of the program:

*******************************************************************
******        Statistics on Transfer (Write)                 ******

*******************************************************************
******        Transfer Mode = 0  I.E.  As Is       ******
******        Transferring Shape, ShapeType = 2                      ******
** WorkSession : Sending all data
 Step File Name : ../solutions/splitPart.stp(1394 ents)  Write  Done
Segmentation fault (core dumped)
Dmitrii Pasukhin's picture

Hello,

It looks not normal. Can you share a version of occt? And gcc version.

As a hot solution, can you add #include <NCollection_Vector.hxx> in your file before including writer?

Best regards, Dmitrii.

IEI245MU5_1's picture

Including NCollection_Vector fixed the problem. Thank you very much!

Dmitrii Pasukhin's picture

Thank you. We will fix it on our side in the next release.

Best regards, Dmitrii.