Undefined Reference to 'IGES_Control_Reader'

Hi Everybody, I am a little bit novice in opencascade technology. Since several days, I encounter an issue on my little Qt project including opencascade libraries. I am trying to build a little simple application (on Window 10) which shall able to read, and visualize an iges file in the mainwindow application. For this purpose, I installed opencascade 7.7.0 with .exe executable for windows (the Qt samples provided with the package work well after installation). Hereafter is the .pro file under Qt Creator (12.0.2) :


QT       += widgets core gui opengl openglwidgets

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    mainwindow.cpp

HEADERS += \
    mainwindow.h \

FORMS += \
    mainwindow.ui

INCLUDEPATH += $$quote(C:/Users/nicolas/Documents/OpenCASCADE-7.7.0-vc14-64/opencascade-7.7.0/inc)

LIBS = -L$$quote(C:/Users/nicolas/Documents/OpenCASCADE-7.7.0-vc14-64/opencascade-7.7.0/win64/vc14/lib)

LIBS += -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl \
        -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 \
        -lTKSTEPBase -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d \
        -lTKXSBase -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \
        -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF

-------------------------------------------------------------------------------------------

Here after my mainwindow.cpp where iges file should be read :

-------------------------------------------------------------------------------------------

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMenuBar>
#include <QAction>
#include <QMessageBox>

#include "IGESControl_Reader.hxx"
#include "TopoDS_Shape.hxx"
#include "BRepTools.hxx"


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setWindowTitle("VPP_0");

  ...

    // menu bar
    QMenuBar *menuBar = this->menuBar();

    // menu
    QMenu *fileMenu = menuBar->addMenu("Fichier");
    QMenu *editMenu = menuBar->addMenu("Editer");
    QMenu *careneMenu = menuBar->addMenu("Carene");

    // action File
    QAction *myFileAction = new QAction("Action_File", this);

    // Connection action File
    connect(myFileAction, &QAction::triggered, this, &MainWindow::onFileMenuActionClicked);
    // Addind action
    fileMenu->addAction(myFileAction);

    // action Edit
    QAction *myEditAction = new QAction("Action_Edit", this);

    // Connection action Edit
    connect(myEditAction, &QAction::triggered, this, &MainWindow::onEditMenuActionClicked);
    // Adding action
    editMenu->addAction(myEditAction);

    // action Carene
    QAction *myCareneAction = new QAction("Action_Carene", this);

    // Connection action Carene
    connect(myCareneAction, &QAction::triggered, this, &MainWindow::onCareneMenuActionClicked);
    // Adding action
    careneMenu->addAction(myCareneAction);


}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::onFileMenuActionClicked()
{ 
    QMessageBox::information(this, "Information", "Button File Clicked !");
}

void MainWindow::onEditMenuActionClicked()
{
    QMessageBox::information(this, "Information", "Button Edit Clicked !");
}

// **********************************************
// Hereafter the method which fails with IGESControl_Reader:
// **********************************************

void MainWindow::onCareneMenuActionClicked()
{

    // create reader IGES
    IGESControl_Reader reader;   // *****Always an Error here ...******

    // read the IGES file
    IFSelect_ReturnStatus status = reader.ReadFile("myfile.igs");

    if (status == IFSelect_RetDone) {
        
        Standard_Integer nbr = reader.TransferRoots();
        TopoDS_Shape shape = reader.OneShape();

        
        QMessageBox::information(this, "Information", "IGES FILE Read !");

    } else {

        QMessageBox::information(this, "Information", "Error on file IGES...");
    }
}

When I compile the project (with Desktop Qt 6.6.2 MinGW 64-bit kit), I have always the same error : undefined reference to `IGESControl_Reader::IGESControl_Reader()' I really don't anderstand why, regarding the .pro file the opencascade libraries are well reached, same for opencascade .hxx file ... An idea ? What I have forgotten to do ? Nicolas

Dmitrii Pasukhin's picture

Hello. Usually that issue is only related to the missed lib during linking. In your case I don't see a reason. Please try any other OCCT classes, just in case. Another possible issue - different RealTime (MSVC vs MinGW). For now please try to use for example:

TopoDS_Compound aComp;
BRep_Builder{}.MakeCompaund(aComp);

MSYS2 have own opencascade delivery, you can check it (pacman). Or you can easy build latest occt with MinGW. The sample: OCCT/.github/workflows/build-multiconfig-mingw.yml at master · Open-Cascade-SAS/OCCT

Best regards, Dmitrii.

Nicolas Philippe's picture

Hi,
Ok thanks I will try these solutions and keep you informed,
Best regard,
Nicolas