[zeromq-dev] conflict between 0MQ and Qt4 C++ libraries?
Aamir M
intuitionist at gmail.com
Mon Apr 20 16:40:22 CEST 2009
Hello,
I think there might be a conflict between the 0MQ C++ library and the Qt4
C++ GUI libraries. I am using Qt's latest LGPL SDK (qtsdk-2009.01). The
following simple program fails to compile with g++ 4.1.2:
#include <QtGui/QApplication>
#include <zmq.hpp>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
return a.exec();
}
The compiler returns the following error:
g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB
-DQT_SHARED -I/opt/qtsdk-2009.01/qt/mkspecs/linux-g++-64 -I.
-I/opt/qtsdk-2009.01/qt/include/QtCore -I/opt/qtsdk-2009.01/qt/include/QtGui
-I/opt/qtsdk-2009.01/qt/include -Idebug -I. -o debug/main.o main.cpp
/usr/local/include/zmq/poller.hpp: In member function ‘bool
zmq::poller_t<T>::process_event(zmq::i_pollable*, zmq::event_t)’:
/usr/local/include/zmq/poller.hpp:268: error: expected unqualified-id before
‘protected’
/usr/local/include/zmq/poller.hpp:269: error: expected primary-expression
before ‘protected’
/usr/local/include/zmq/poller.hpp:269: error: expected `)' before
‘protected’
/usr/local/include/zmq/poller.hpp:269: error: expected `)' before ‘;’ token
/usr/local/include/zmq/poller.hpp:276: error: expected primary-expression
before ‘protected’
/usr/local/include/zmq/poller.hpp:276: error: expected `)' before
‘protected’
make[1]: *** [debug/main.o] Error 1
HOWEVER, I can get the program to compile if I reverse the order of the
include statements so that it reads:
#include <zmq.hpp>
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
return a.exec();
}
The "offending" lines in the 0MQ poller.hpp file are:
/usr/local/include/zmq/poller.hpp:268: uint32_t signals = signaler.check ();
/usr/local/include/zmq/poller.hpp:269: assert (signals);
/usr/local/include/zmq/poller.hpp:276: if (signals & (1 <<
source_thread_id)) {
It might be a namespace collision with Qt's "signals/slots" mechanism.
Thanks,
Aamir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090420/15b620a6/attachment.htm>
More information about the zeromq-dev
mailing list