Creating a QApplication with Matlab Engine

조회 수: 2 (최근 30일)
Preetham Chalasani
Preetham Chalasani 2018년 4월 17일
댓글: Preetham Chalasani 2018년 4월 17일
I'm trying to create a qt application with matlab engine. The program is throwing Segmentation fault when it tires to create a QApplication object. Following is the sample code that seg faults.
#include <QApplication>
int main(int argc, char **argv)
{
QApplication application(argc, argv);
return 0;
}
Following is the CMakeLists.txt that goes along with this.
cmake_minimum_required(VERSION 3.4)
find_package(Qt5Widgets)
find_package(Matlab REQUIRED COMPONENTS ENG_LIBRARY MX_LIBRARY)
include_directories(${Matlab_INCLUDE_DIRS})
add_executable( example main.cpp)
target_link_libraries(example ${Matlab_LIBRARIES} Qt5::Widgets )
I tried compiling against 2017a and 2018a, but no luck.
Any help would be much appreciated.
  댓글 수: 2
Preetham Chalasani
Preetham Chalasani 2018년 4월 17일
I managed to find the problem. It was linking against different libraries from different matlab versions. After cleaning that up and making sure all the libraries are from 2018a, now the program seg faults at application.exec
#include <QApplication>
int main(int argc, char **argv)
{
QApplication application(argc, argv);
return application.exec();
}
Preetham Chalasani
Preetham Chalasani 2018년 4월 17일
It seems that libQt5XcbQpa.so.5 was creating a problem. It was being dynamically loaded from the $matlabroot/bin/glnxa64 instead from /usr/lib/x86_64-linux-gnu/ and creating a compatibility issue. Renaming $matlabroot/bin/glnxa64/libQt5XcbQpa.so.5 was my temporary fix.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by