QT posix message queue
Solved
General and Desktop
-
@jish This builds on my machine in QtCreator:
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QDebug> #include <mqueue.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); mqd_t mqid; mqid=mq_open("/hmi_chnl_ic",O_RDONLY); if(mqid==-1) { qDebug()<<"error opening message queue"; } } MainWindow::~MainWindow() { delete ui; }
pro file:
#------------------------------------------------- # # Project created by QtCreator 2017-05-19T09:26:01 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = test_mqueue TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS LIBS += -lrt SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui
You need to add -lrt to be able to link.