Solved error: 'QCopChannel' was not declared in this scope
-
Hi All,
I am trying to understand the QCOP IPC level communication and what I understand so far is that QCOP is something similar to POSIX Message Queues.
To test the power and feasibility I am developing a test application but getting subject error that I am unable to solve. Any body who can help me creating a test application, below is a sample code of my QT Core GUI application:#include <QCopChannel> void MainWindow::on_pushButton_clicked() { // **QCopchannel qcopreceiver** = new QCopChannel(QCString("MYCHANNEL"), this, "myreceiver"); **QCopChannel qcopreceiver** = new QCopChannel("MYCHANNEL",this); connect (qcopreceiver, SIGNAL(received(const QCString&,const QByteArray&)),this, SLOT(receivedSoemthing(const QCString&,const QByteArray&)) ); }
The error appears on both qcopreceiver initialization.
Thanks
-
Do you have a Java / C# background? Because the line
QCopchannel qcopreceiver = new QCopChannel(QCString("MYCHANNEL"), this, "myreceiver");
tries to assign a pointer on aQCopChannel
to aQCopChannel
instance, i.eQCopChannel*
assigned toQCopChannel
.The line should read
QCopchannel* qcopreceiver = new QCopChannel(QCString("MYCHANNEL"), this, "myreceiver");
Moreover there is a small typo in your commented line
QCopChannel
instead ofQCopchannel
. -
Hi @JohanSolo,
This line was commented in my code, where as in second line I mistakenly removed * to make the text bold.
I replaced the line with suggested one but still getting same error. I am using QT 4.8.2 on Debian Linux:QCopChannel* qcopreceiver = new QCopChannel(QCString("MYCHANNEL"), this, "myreceiver");
&
QCopchannel* qcopreceiver = new QCopchannel(QCString("MYCHANNEL"), this, "myreceiver");
-
@Kashif From Qt's docs:
Note that this class is only available in Qt for Embedded Linux.
-
Hi @medyakovvit,
What should we send if parent class (This) is not available?
Ps, I have used "This" keyword in many places during my device POC, like when initializing QTcpSocket/Connecting signals & slots on both Desktop and Embedded Linux (tested and working on device)
Thanks
-
@Kashif He means that QCopChannel is only available for embedded Linux.
See here: http://doc.qt.io/qt-4.8/qcopchannel.html#details -
Hi @jsulm,
Yes I have read that QCop is only available in embedded Linux and I am also building the project in embedded Linux configuration.
-
What version of Qt are you using?
-
Hi @VRonin,
I am using QT 4.8.2 on Debian Linux.
-
Hi,
Did you compile that version of Qt with the embedded flag ?
Are you locked to that version of Qt ? If you can't go with Qt 5 then at least update to 4.8.7.
-
Hi @SGaist,
In project configuration I have selected the project > target = Embedded Linux > Build releaseI can not upgrade the QT version as this is recommended by the hardware vendor.
-
@Kashif The question was whether Qt itself was build with embedded flag set.
-
Hi @jsulm,
I am new to QT environment, can you please tell me how do I check this?
-
@Kashif How did you install Qt?
-
Hi @jsulm,
I use synaptic package manager to simply install QT creator
-
@Kashif Then I guess you simply installed Qt which comes with your Linux distribution and isn't build for embedded Linux.
-
If recommended is 4.8.2 then 4.8.7 should work as well.
If you want to build your application and test it on your desktop, you'll have to do an x86 embedded build.
-
Hi @jsulm,
As per my knowledge, QT itself (or QT Creator) is not an environment but just an IDE. To build application for embedded systems we have to use cross compiler to compile and link the code and that is what I am doing here. -
Hi @jsulm,
I finally compiled the code successfully, it seems that correct compiler was not being called with make file.
-
@Kashif QtCreator is an IDE, Qt is a C++ framework