Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error : undefined reference to 'engOpen'

Error : undefined reference to 'engOpen'

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 3.7k 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
    anfedres
    wrote on last edited by
    #1

    I'm trying to connect Matlab with QT. I'm using Qt Creator 4.2 and QT 5.8. This is what I have in my .pro file.

    QT       += core gui serialport axcontainer
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = Totem_app
    TEMPLATE = app
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #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
    
    CONFIG+=c++11
    
    
    win32:CONFIG(release, debug|release): LIBS += -L'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/' -llibmx
    else:win32:CONFIG(debug, debug|release): LIBS += -L'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/' -llibmxd
    
    INCLUDEPATH += 'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft'
    DEPENDPATH += 'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft'
    

    I have also include the head file.

    #include <QFileDialog>
    #include <QtPlugin>
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QThread>
    #include <QTextCodec>
    #include "C:\Program Files\MATLAB\R2016b\extern\include\engine.h"
    

    Could somebody help me with this problem? How could I include engine.h without providing the whole path directory? What am I doing wrong that I'm getting the undefined reference error? All help is highly appreciated it.

    VRoninV 1 Reply Last reply
    0
    • A anfedres

      I'm trying to connect Matlab with QT. I'm using Qt Creator 4.2 and QT 5.8. This is what I have in my .pro file.

      QT       += core gui serialport axcontainer
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = Totem_app
      TEMPLATE = app
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which as been marked as deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #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
      
      CONFIG+=c++11
      
      
      win32:CONFIG(release, debug|release): LIBS += -L'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/' -llibmx
      else:win32:CONFIG(debug, debug|release): LIBS += -L'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/' -llibmxd
      
      INCLUDEPATH += 'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft'
      DEPENDPATH += 'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft'
      

      I have also include the head file.

      #include <QFileDialog>
      #include <QtPlugin>
      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include <QThread>
      #include <QTextCodec>
      #include "C:\Program Files\MATLAB\R2016b\extern\include\engine.h"
      

      Could somebody help me with this problem? How could I include engine.h without providing the whole path directory? What am I doing wrong that I'm getting the undefined reference error? All help is highly appreciated it.

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      How could I include engine.h without providing the whole path directory?

      it should be

      INCLUDEPATH += 'C:/Program Files/MATLAB/R2016b/extern/include'
      DEPENDPATH += 'C:/Program Files/MATLAB/R2016b/extern/include'
      

      and your include just be #include <engine.h>
      but this does not solve your problem, I don't have matlab so i can't test it, can you post the contents of C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/

      What compiler are you using (including architecture 32/64 bit)?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      A 1 Reply Last reply
      1
      • VRoninV VRonin

        How could I include engine.h without providing the whole path directory?

        it should be

        INCLUDEPATH += 'C:/Program Files/MATLAB/R2016b/extern/include'
        DEPENDPATH += 'C:/Program Files/MATLAB/R2016b/extern/include'
        

        and your include just be #include <engine.h>
        but this does not solve your problem, I don't have matlab so i can't test it, can you post the contents of C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/

        What compiler are you using (including architecture 32/64 bit)?

        A Offline
        A Offline
        anfedres
        wrote on last edited by anfedres
        #3

        @VRonin Thank you so much for your help. This is what I have in the folder
        alt text

        This is my qt version
        alt text

        The compiler that I'm using is MinGW 32 bit. Is there more information that I should provide? Is it possible to do this on QT creator?

        VRoninV 1 Reply Last reply
        0
        • A anfedres

          @VRonin Thank you so much for your help. This is what I have in the folder
          alt text

          This is my qt version
          alt text

          The compiler that I'm using is MinGW 32 bit. Is there more information that I should provide? Is it possible to do this on QT creator?

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by VRonin
          #4

          @anfedres said in Error : undefined reference to 'engOpen':

          The compiler that I'm using is MinGW 32 bit

          lib/win64/microsoft

          You can't mix and match compilers. You are trying to use MSVC?? 64 bit libraries with MinGW at 32 bit

          Either you install the same version of Visual Studio those libraries were built in or you search for those of your compiler: C:/Program Files/MATLAB/R2016b/extern/lib/win32/gcc maybe?

          Once you found them you also have to find out what library engOpen is in. currently you are linking only libmx. Given one of the libraries is called libeng I'd go with that one if I had to bet

          P.S.

          This is my qt version

          No, that's your Qt Creator Version, to see the Qt Version you have to look here:
          Qt Version

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          A 2 Replies Last reply
          2
          • VRoninV VRonin

            @anfedres said in Error : undefined reference to 'engOpen':

            The compiler that I'm using is MinGW 32 bit

            lib/win64/microsoft

            You can't mix and match compilers. You are trying to use MSVC?? 64 bit libraries with MinGW at 32 bit

            Either you install the same version of Visual Studio those libraries were built in or you search for those of your compiler: C:/Program Files/MATLAB/R2016b/extern/lib/win32/gcc maybe?

            Once you found them you also have to find out what library engOpen is in. currently you are linking only libmx. Given one of the libraries is called libeng I'd go with that one if I had to bet

            P.S.

            This is my qt version

            No, that's your Qt Creator Version, to see the Qt Version you have to look here:
            Qt Version

            A Offline
            A Offline
            anfedres
            wrote on last edited by
            #5

            @VRonin But I'm not using Visual Studio. Is it possible to install another compiler for QT?

            VRoninV 1 Reply Last reply
            0
            • VRoninV VRonin

              @anfedres said in Error : undefined reference to 'engOpen':

              The compiler that I'm using is MinGW 32 bit

              lib/win64/microsoft

              You can't mix and match compilers. You are trying to use MSVC?? 64 bit libraries with MinGW at 32 bit

              Either you install the same version of Visual Studio those libraries were built in or you search for those of your compiler: C:/Program Files/MATLAB/R2016b/extern/lib/win32/gcc maybe?

              Once you found them you also have to find out what library engOpen is in. currently you are linking only libmx. Given one of the libraries is called libeng I'd go with that one if I had to bet

              P.S.

              This is my qt version

              No, that's your Qt Creator Version, to see the Qt Version you have to look here:
              Qt Version

              A Offline
              A Offline
              anfedres
              wrote on last edited by
              #6

              @VRonin I understand now. I'm trying to link libraries for MSVC, instead. I should be using libraries for MinGW.

              1 Reply Last reply
              1
              • A anfedres

                @VRonin But I'm not using Visual Studio. Is it possible to install another compiler for QT?

                VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by VRonin
                #7

                But I'm not using Visual Studio. Is it possible to install another compiler for QT?

                The only way to install MSVC before MSVC2015 is installing Visual Studio that's why I mentioned it. once you have the compiler you can use whatever IDE you prefer (like Qt Creator). You can use the build tools without installing Visual Studio for MSVC2015 but the first thing you have to find out is what version those libraries were built with

                A way to do it is using dependency walker: http://www.dependencywalker.com/ open the library if one of the dependencies is contains MSVCP14 then it's MSVC2015, if it contains MSVCP12 then it's MSVC2013

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                2
                • A Offline
                  A Offline
                  anfedres
                  wrote on last edited by
                  #8

                  It seems that I will have to install something else. Or use a different approach. How about Qprocess? It won't work the same. But my goal is call a program that I have done in Matlab and run it.

                  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