Results 1 to 2 of 2

Thread: loading matlab using Qt error

  1. #1
    Join Date
    Sep 2014
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    3

    Default loading matlab using Qt error

    I have successfully loaded matlab files using visual studio 13.0

    Now I want to do same with Qt but getting errors. here is my .pro file

    Qt Code:
    1. QT += core gui
    2.  
    3. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    4.  
    5. TARGET = matlabtest
    6. TEMPLATE = app
    7.  
    8. INCLUDEPATH += "C:\Program Files\MATLAB\R2014a\extern\include"
    9.  
    10. SOURCES += main.cpp\
    11. mainwindow.cpp \
    12. stdafx.cpp
    13.  
    14. HEADERS += mainwindow.h \
    15. stdafx.h\
    16. targetver.h
    17.  
    18. FORMS += mainwindow.ui
    19.  
    20.  
    21. INCLUDEPATH += $$PWD/
    22. DEPENDPATH += $$PWD/
    23.  
    24. win32: LIBS += -L$$PWD/ -llibeng
    25. win32: LIBS += -L$$PWD/ -llibmat
    26. win32: LIBS += -L$$PWD/ -llibmex
    27. win32: LIBS += -L$$PWD/ -llibmx
    To copy to clipboard, switch view to plain text mode 
    I have copied the library files into my own project directory... when I run the program using following code

    Qt Code:
    1. #include "mainwindow.h"
    2. #include <QApplication>
    3. #include "stdafx.h"
    4. #include "engine.h"
    5. #include "cmath"
    6. #include "stdlib.h"
    7. using namespace std;
    8.  
    9. #pragma comment (lib, "libmx.lib")
    10. #pragma comment (lib, "libmex.lib")
    11. #pragma comment (lib, "libmat.lib")
    12. #pragma comment (lib, "libeng.lib")
    13.  
    14. int main(int argc, char *argv[])
    15. {
    16. QApplication a(argc, argv);
    17. MainWindow w;
    18. w.show();
    19.  
    20. engine *promat;
    21. promat = engOpen("null");
    22. engEvalString(promat, "eval('final1022');");
    23. return a.exec();
    24. }
    To copy to clipboard, switch view to plain text mode 
    I get error as below

    main.obj:-1: error: LNK2019: unresolved external symbol _engEvalString referenced in function _main

    main.obj:-1: error: LNK2019: unresolved external symbol _engOpen referenced in function _main
    how can I fix this... note that this works fine with VS2013

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: loading matlab using Qt error

    Are those libraries in the path you specified (in the source directory)?

    Are the libraries compiled with the same compiler you are building the application with?

    And you are saying it works when you build this Qt program with VS2013?
    How are you building it when it does not work?

    Cheers,
    _

Similar Threads

  1. Qt to Matlab (mat format) export data to Matlab .mat format -v4
    By windsword in forum Qt-based Software
    Replies: 4
    Last Post: 26th February 2013, 20:01
  2. error while loading shared libraries
    By RolandHughes in forum General Programming
    Replies: 1
    Last Post: 13th February 2013, 16:26
  3. Replies: 1
    Last Post: 8th May 2011, 23:11
  4. Error loading plugin dinamically
    By Zero in forum Qt Programming
    Replies: 2
    Last Post: 23rd January 2010, 23:31
  5. Error Loading MySql Driver in 4.3.4
    By perrigo in forum Qt Programming
    Replies: 5
    Last Post: 26th March 2008, 14:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.