Creating a QApplication with Matlab Engine

2 visualizaciones (últimos 30 días)
Preetham Chalasani
Preetham Chalasani el 17 de Abr. de 2018
Comentada: Preetham Chalasani el 17 de Abr. de 2018
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 comentarios
Preetham Chalasani
Preetham Chalasani el 17 de Abr. de 2018
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 el 17 de Abr. de 2018
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by