PDA

View Full Version : Unable to deploy Matlab Built C LIbrary onto Qt Platform



alok9871
23rd January 2013, 05:00
Hi

I have started working on Qt very recently and have been able something by following this forum. I basically work on signal processing algorithms. I have created a C shared library using the Matlab C Compiler. I wanted it to be integrated to my Qt Project.

Before adding the library, I first created a standalone C Executable, to see if the code runs. It does. I get Matlab Plots as well. Everything all right till here. But that's not what i want. I need to change the parameters on from the Qt. Hence, the need for the library.

Since I am very new in it, I followed the forums and blogs to get it done. This is essentially what i followed.

http://michael-stengel.com/blog/?p=89 (http://http://michael-stengel.com/blog/?p=89)

My Project file looks something like this



#-------------------------------------------------
#
# Project created by QtCreator 2013-01-18T18:12:26
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = bingshing
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp \
../../../projectsarson/src/projectsarson.c \
../../../projectsarson/src/projectsarson_mcc_component_data.c

HEADERS += mainwindow.h \
../../../projectsarson/src/projectsarson.h \

FORMS += mainwindow.ui


unix|win32-msvc2010: LIBS += -L"C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/lib/win32/microsoft/" -lmclmcrrt

INCLUDEPATH += "C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/lib/win32/microsoft"
DEPENDPATH += "C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/lib/win32/microsoft"
INCLUDEPATH += "C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/include"
DEPENDPATH += "C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/include"
win32: PRE_TARGETDEPS += "C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/lib/win32/microsoft/mclmcrrt.lib"
else:unix: PRE_TARGETDEPS += "C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/lib/win32/microsoft/libmclmcrrt.a"
#LIBS += "C:/Program Files (x86)/MATLAB/MATLAB Compiler Runtime/v78/extern/lib/win32/microsoft" -llibeng -llibmat -llibmx

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../projectsarson/src/ -lprojectsarson
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../projectsarson/src/ -lprojectsarson
else:unix: LIBS += -L$$PWD/../../../projectsarson/src/ -lprojectsarson

INCLUDEPATH += $$PWD/../../../projectsarson/src
DEPENDPATH += $$PWD/../../../projectsarson/src

win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../projectsarson/src/projectsarson.lib
else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../projectsarson/src/projectsarson.lib
else:unix: PRE_TARGETDEPS += $$PWD/../../../projectsarson/src/libprojectsarson.a

OTHER_FILES += \
../../../projectsarson/src/projectsarson.exp \



When I try to run the code, the application stops working and it gives me following result : exited with code -1073741819


I tried to search in the forum and found that it might be an access violation. I ran qt as an administrator. Still the same

I don't understand where I am going wrong.

Please Please help me with this problem

Thanks & Regards

Santosh Reddy
23rd January 2013, 05:05
Where does this segmentation fault happen? I mean in the library?, or the interface code?

Try building the library in debug mode and debug it from Qt code.