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
Code:
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
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[])
{
MainWindow w;
w.show();
engine *promat;
promat = engOpen("null");
engEvalString(promat, "eval('final1022');");
return a.exec();
}
I get error as below
Quote:
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
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,
_