habbas33
5th November 2015, 09:16
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 += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = matlabtest
TEMPLATE = app
INCLUDEPATH += "C:\Program Files\MATLAB\R2014a\extern\include"
SOURCES += main.cpp\
mainwindow.cpp \
stdafx.cpp
HEADERS += mainwindow.h \
stdafx.h\
targetver.h
FORMS += mainwindow.ui
INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/
win32: LIBS += -L$$PWD/ -llibeng
win32: LIBS += -L$$PWD/ -llibmat
win32: LIBS += -L$$PWD/ -llibmex
win32: LIBS += -L$$PWD/ -llibmx
I have copied the library files into my own project directory... when I run the program using following code
#include "mainwindow.h"
#include <QApplication>
#include "stdafx.h"
#include "engine.h"
#include "cmath"
#include "stdlib.h"
using namespace std;
#pragma comment (lib, "libmx.lib")
#pragma comment (lib, "libmex.lib")
#pragma comment (lib, "libmat.lib")
#pragma comment (lib, "libeng.lib")
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
engine *promat;
promat = engOpen("null");
engEvalString(promat, "eval('final1022');");
return a.exec();
}
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
Now I want to do same with Qt but getting errors. here is my .pro file
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = matlabtest
TEMPLATE = app
INCLUDEPATH += "C:\Program Files\MATLAB\R2014a\extern\include"
SOURCES += main.cpp\
mainwindow.cpp \
stdafx.cpp
HEADERS += mainwindow.h \
stdafx.h\
targetver.h
FORMS += mainwindow.ui
INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/
win32: LIBS += -L$$PWD/ -llibeng
win32: LIBS += -L$$PWD/ -llibmat
win32: LIBS += -L$$PWD/ -llibmex
win32: LIBS += -L$$PWD/ -llibmx
I have copied the library files into my own project directory... when I run the program using following code
#include "mainwindow.h"
#include <QApplication>
#include "stdafx.h"
#include "engine.h"
#include "cmath"
#include "stdlib.h"
using namespace std;
#pragma comment (lib, "libmx.lib")
#pragma comment (lib, "libmex.lib")
#pragma comment (lib, "libmat.lib")
#pragma comment (lib, "libeng.lib")
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
engine *promat;
promat = engOpen("null");
engEvalString(promat, "eval('final1022');");
return a.exec();
}
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