For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

undefined reference

Jonas Greif's picture

Hello Guys, 

im new to OCC and its been quite a while ive programmed in C/C++. Im working on Windows with Code::Blocks.

Im planning to write a short routine which loads two step files, translates them into occ shapes, applies a boolean operation, and writes the translated result as a step file.

At the moment i receive some undefined reference errors like these :

'undefined reference to 'STEPControl_Reader::STEPControl_Reader()'

'undefined reference to 'XSControl_Reader::ReadFile(char const*)'


Ive set the right directory for compiling, but i supect (as i read) that i have to explicitly link some librarys, but im not sure which or if its another error ive made

 My code looks like this so far :

#include <limits.h>

// Reader/Writer
#include <TopoDS_Shape.hxx>
#include <STEPControl_Reader.hxx>
#include <BRepTools.hxx>
//#include <STEPControl.hxx>
#include <STEPControl_Writer.hxx>
#include <BRep_Builder.hxx>

// Boolean
#include <BRepBuilderAPI_Command.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
#include <BRepAlgoAPI_Cut.hxx>

int main(int argc, char *argv[])
    // Read
    STEPControl_Reader reader1;
    TopoDS_Shape shape_A = reader1.OneShape();

    STEPControl_Reader reader2;
    TopoDS_Shape shape_B = reader2.OneShape();

    // Cut
    TopoDS_Shape shape_cut = BRepAlgoAPI_Cut(shape_A, shape_B);

    // Write

    STEPControl_Writer writer;
    IFSelect_ReturnStatus stat1 = writer.Transfer(shape_cut,STEPControl_ManifoldSolidBrep);
    IFSelect_ReturnStatus stat2 = writer.Write("shape_cut.stp");