QT posix message queue
-
@jsulm no idont have this header file in my system.That is why i'm asking where do add this header.
-
@jsulm no idont have this header file in my system.That is why i'm asking where do add this header.
-
@jish Do you use a Linux distribution?
If so then install needed package. On Ubuntu you need to install libc6-dev package. -
@jsulm i'm using linux distribution.
i am able to use mqueue.h in my linux program without any error. Only using with qt showed the error message. -
@jsulm said in QT posix message queue:
find /usr -name mqueue.h
output
/usr/include/mqueue.h
/usr/include/x86_64-linux-gnu/bits/mqueue.h
/usr/include/linux/mqueue.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/posix/mqueue.h
/usr/src/linux-headers-3.13.0-117/include/uapi/linux/mqueue.h
/usr/src/linux-headers-3.13.0-117-generic/include/config/posix/mqueue.h
/usr/src/linux-headers-3.13.0-24/include/uapi/linux/mqueue.h -
@jsulm said in QT posix message queue:
find /usr -name mqueue.h
output
/usr/include/mqueue.h
/usr/include/x86_64-linux-gnu/bits/mqueue.h
/usr/include/linux/mqueue.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/posix/mqueue.h
/usr/src/linux-headers-3.13.0-117/include/uapi/linux/mqueue.h
/usr/src/linux-headers-3.13.0-117-generic/include/config/posix/mqueue.h
/usr/src/linux-headers-3.13.0-24/include/uapi/linux/mqueue.h -
@jsulm said in QT posix message queue:
find /usr -name mqueue.h
output
/usr/include/mqueue.h
/usr/include/x86_64-linux-gnu/bits/mqueue.h
/usr/include/linux/mqueue.h
/usr/src/linux-headers-3.13.0-24-generic/include/config/posix/mqueue.h
/usr/src/linux-headers-3.13.0-117/include/uapi/linux/mqueue.h
/usr/src/linux-headers-3.13.0-117-generic/include/config/posix/mqueue.h
/usr/src/linux-headers-3.13.0-24/include/uapi/linux/mqueue.h -
@jsulm same..no such file or directory.
And i can't upload the the project since i'm working with a company.
Can you please try open a message queue using mq_open in qt creator?@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.
-
@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.