Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Qt Project & Matlab Engine (Linux 64 bits)
QtWS25 Last Chance

Qt Project & Matlab Engine (Linux 64 bits)

Scheduled Pinned Locked Moved C++ Gurus
3 Posts 2 Posters 4.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    avmg
    wrote on last edited by
    #1

    Hi everyone,

    I'm trying to use Matlab Engine (Matlab R2013a) in a Qt Project (Qt 5.2.0, GCC 4.6.1, 64 bit). My GCC version is 4.7.3 and Matlab documents says compatible with 4.4.X, but i read about this and looks like it's compatible. I found many solutions for Windows but any one clear enought for Linux 64 bits. I set the run-time library path in the Qt build environment:

    LD_LIBRARY_PATH=matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64

    I tried to add also the shared libraries: libmat.so, libmx.so and libeng.so but i'm not sure if it is well done.

    This is my .pro file:

    @QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = ahrs_libusb
    TEMPLATE = app

    SOURCES += main.cpp
    ahrs.cpp

    HEADERS += ahrs.h

    FORMS += ahrs.ui

    LIBS += -lusb
    unix:LIBS += -lusb

    LIBS += -L /usr/local/MATLAB/R2013a/bin/glnxa64/
    /usr/local/MATLAB/R2013a/bin/glnxa64/libmat.so
    /usr/local/MATLAB/R2013a/bin/glnxa64/libmx.so
    /usr/local/MATLAB/R2013a/bin/glnxa64/libeng.so

    INCLUDEPATH += /usr/local/MATLAB/R2013a/extern/include@

    And this is the test when create the form:

    @Engine * ep = engOpen (NULL);
    if (!ep)
    {
        ui->qTEstatus->append("Can start Matlab engine!");
    }@
    

    Actually i compile and i get these two errors:

    /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6:-1: error: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl_c.so.4)

    and

    /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6:-1: error: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl.so.12)

    I spend much time but without any solution...

    Thanks,
    Andrew.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      avmg
      wrote on last edited by
      #2

      Hi again,

      Finally, I found an easy way to solve the problem by linking the correct library file with the MATLAB firstly searched old library file, i.e.,

      sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 /usr/local/MATLAB/R2013a/bin/glnxa64/libstdc++.so.6

      Now the program compile but the Matlab Engine doesn't run because the function: engOpen(NULL) returns 0x00

      Any idea??

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pranavladkat
        wrote on last edited by
        #3

        Can you guide me linking matlab's engine.h to qt?

        I have 64bit versions of both ubuntu(12.04) and qt(5.2.1)

        I'm able to compile the code with engine.h included in the program but I get the following error:
        MATLAB: Command not found

        Any ideas?

        my .pro file is:
        @TEMPLATE = app
        CONFIG += console
        CONFIG -= app_bundle
        CONFIG -= qt
        INCLUDEPATH += "/usr/local/MATLAB/MATLAB_Production_Server/R2013a/extern/include"

        LIBS += -llapack -lblas -larmadillo -L"/usr/local/MATLAB/MATLAB_Production_Server/R2013a/bin/glnxa64" -leng -lmat -lmex -lmx -Wl,-rpath=/usr/local/MATLAB/MATLAB_Production_Server/R2013a/bin/glnxa64

        SOURCES += main.cpp@

        and using a simple program to test the connectivity.

        I have define the PATH variable. But I'm doubtful about the way I have defined LD_LIBRARY_PATH

        Can you please elaborate how you were able to link matlab to qt?

        Thanks,
        Pranav

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved