Configure matlab engine in qtcreator
-
Hi,
Aren't you mixing 32 and 64 bit MinGW ?
By the you should rather use forward slashes everywhere. Qt handles the conversion for you. Otherwise use double backslashes.
-
So I checked and it seem that the matlab libraries were compiled using minGW-w64 while I'm using minGW 5.3 32 bit. Can the errors I obtain be the results of this imcompatibility?
So I configured a new kit with MSVC2015 64bit compiler but I get the following error :mainwindow.obj:-1: error: LNK2019: unresolved external symbol engOpen referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
-
@Zhitoune
well to be 100% sure, please delete the build folder. ( in this case)
This is normally not needed but if anything remains from the minGw compile and u now are using visual studio then odd errors will pop up.
( the .o files should in other folder, but better sure than sorry)Often rebuild is enough but sometimes full deletion is needed.
Update:
Sorry, i misread.
it complains about engOpen
which i assume is from the MATLAB lib -
@Zhitoune
And the MATLAB r2017b libraries are compiled with 2015/2017 64 bit ?Higher up you show
C:\MATLAB\R2017b\extern\lib\win64\mingw64\libeng.lib"but maybe it also contains libs for visual studio in other folder than mingw64 ?
Ah yes, seems to be in
c:\matlab\r2017a\extern\lib\win64\microsoftSo those are 2015/2015 compiled?
You cannot fix DLLS from other compilers. It must be same compiler for App and
matlab libs.So mingw32 wont load 64 bit mingw.
but so we are clear.
You are now using
MSVC2015 compiler (installed by your self)
Qt 2015 version kit
and points to
win32:LIBS += -L"c:\matlab\r2017a\extern\lib\win64\microsoft" -leng
-L"c:\MATLAB\R2017a\extern\lib\win64\microsoft" -lmxfrom .pro file?
-
So it's finaly working with a kit made of :
Desktop Qt 5.9.2
MSVC2015 64bitand my .pro file looks like this :
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = testMatlabEngine TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS CONFIG += create_prl CONFIG += link_prl SOURCES += main.cpp \ mainwindow.cpp HEADERS += mainwindow.h \ engine.h matrix.h DISTFILES += \ codeMatlab.m LIBS += -L"C:/MATLAB/R2017b/extern/lib/win64/microsoft/" -llibeng \ -L"C:/MATLAB/R2017b/extern/lib/win64/microsoft/" -llibmx INCLUDEPATH += C:/MATLAB/R2017b/extern/include
Thank you very for your help!!!!