linking OpenCascade libraries to C++ programs

I wrote the following C++ program that checks validates a STEP file:

#include "STEPControl_Reader.hxx"
using namespace std;

#define FILENAME "linkrods.step"

int main (int argc, char* argv[])

// create reader and read the STEP file
STEPControl_Reader reader;
IFSelect_ReturnStatus stat = reader.ReadFile(FILENAME);
if (stat != IFSelect_RetDone)
if (stat == IFSelect_RetVoid)

else if (stat == IFSelect_RetError)

return 0;

// check the validity of the STEP file
IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
reader.PrintCheckLoad(false, mode);


I can compile this, but I cant link the program because I can't find any OpenCascade libraries.

What libraries should we use in this situation? Are they available?

Any help is greatly appreciated!!!


Valery Ovchinnikov's picture

You can take it from OCC-examples, e.g. from ImportExport.
Also if you compile it under Windows, don't forget to set the variable WNT (#define WNT)

Peter Djalaliev's picture

I am working under Red Hat 8.

I found the source for the ImportExportPackage, but it is linked through JNI (it seems). How can I link this into a C++ program?

Maybe I don't know what to be looking for, I am not sure.