DBus C++ and Sig C++ does not compile on Qt Creator 4.5.2 Based on Qt 5.9.5 (GCC 7.3.0, 32 bit)
-
If I go into the details of the reasons I'm using DBus C++, considering it as a proof of concept.
I'm trying to compile a simple code that uses:
- DBus C++ and Sig C++,
- Qt Creator 4.5.2 Based on Qt 5.9.5 (GCC 7.3.0, 32 bit),
- g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
- Linux Estudio-3 4.15.0-154-generic #161-Ubuntu SMP Fri Jul 30 13:00:24 UTC 2021 i686 i686 i686 GNU/Linux
I made the following adjustment in the QMake settings directly in the
file .pro
of the project:QT += core gui #QT += dbus greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++1z DEPENDPATH += /usr/local/include/dbus-cxx-2.0 DEPENDPATH += /usr/local/include/sigc++-3.0 INCLUDEPATH += /usr/local/include/dbus-cxx-2.0 INCLUDEPATH += /usr/local/include/sigc++-3.0 INCLUDEPATH += /usr/local/lib/sigc++-3.0/include/ TARGET = SIMULinho TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ simulinho.cpp \ main.cpp \ memorytable.cpp HEADERS += \ simulinho.h \ memorytable.h FORMS += \ simulinho.ui win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../SIMULinho_LIB/release/ -lSIMULinho_LIB else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../SIMULinho_LIB/debug/ -lSIMULinho_LIB else:unix: LIBS += -L$$OUT_PWD/../SIMULinho_LIB/ -lSIMULinho INCLUDEPATH += $$PWD/../SIMULinho_LIB DEPENDPATH += $$PWD/../SIMULinho_LIB win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../EquipoGraph_LIB/release/ -lEquipoGraph else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../EquipoGraph_LIB/debug/ -lEquipoGraph else:unix: LIBS += -L$$OUT_PWD/../EquipoGraph_LIB/ -lEquipoGraph INCLUDEPATH += $$PWD/../EquipoGraph_LIB DEPENDPATH += $$PWD/../EquipoGraph_LIB RESOURCES += \ memory.qrc win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../SIMULinho_LIB_DBus/release/ -lSIMULinho else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../SIMULinho_LIB_DBus/debug/ -lSIMULinho else:unix: LIBS += -L$$OUT_PWD/../SIMULinho_LIB_DBus/ -lSIMULinho INCLUDEPATH += $$PWD/../SIMULinho_LIB_DBus DEPENDPATH += $$PWD/../SIMULinho_LIB_DBus unix: CONFIG += link_pkgconfig unix: PKGCONFIG += dbus-cxx-2.0 unix: PKGCONFIG += dbus-cxx-qt-2.0 QMAKE_CXXFLAGS += -std=gnu++17
But when I try to run the application I get the following error:
isystem /usr/include/libdrm -I. -I/usr/lib/i386-linux-gnu/qt5/mkspecs/linux-g++ -o main.o ../../SIMULinho/SIMULinho_UI/main.cpp In file included from /usr/local/include/sigc++-3.0/sigc++/sigc++.h:118:0, from /usr/local/include/dbus-cxx-2.0/dbus-cxx/utility.h:32, from /usr/local/include/dbus-cxx-2.0/dbus-cxx/signal.h:20, from /usr/local/include/dbus-cxx-2.0/dbus-cxx/connection.h:22, from /usr/local/include/dbus-cxx-2.0/dbus-cxx.h:28, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbus.h:10, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbusserver.h:8, from ../../SIMULinho/SIMULinho_UI/main.cpp:3: /usr/local/include/sigc++-3.0/sigc++/signal.h: In constructor ‘sigc::internal::temp_slot_list::temp_slot_list(sigc::internal::temp_slot_list::slot_list&)’: /usr/local/include/sigc++-3.0/sigc++/signal.h:208:59: error: value-initialization of reference type ‘sigc::internal::temp_slot_list::slot_list& {aka std::__cxx11::list<sigc::slot_base>&}’ explicit temp_slot_list(slot_list& slots) : slots_(slots) ^ /usr/local/include/sigc++-3.0/sigc++/signal.h: At global scope: /usr/local/include/sigc++-3.0/sigc++/signal.h:254:30: error: expected unqualified-id before ‘const’ static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl, ^~~~~ /usr/local/include/sigc++-3.0/sigc++/signal.h:254:30: error: expected ‘)’ before ‘const’ /usr/local/include/sigc++-3.0/sigc++/signal.h:296:30: error: expected unqualified-id before ‘const’ static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl, ^~~~~ /usr/local/include/sigc++-3.0/sigc++/signal.h:296:30: error: expected ‘)’ before ‘const’ /usr/local/include/sigc++-3.0/sigc++/signal.h:353:30: error: expected unqualified-id before ‘const’ static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl, ^~~~~ /usr/local/include/sigc++-3.0/sigc++/signal.h:353:30: error: expected ‘)’ before ‘const’ /usr/local/include/sigc++-3.0/sigc++/signal.h:451:47: error: invalid declarator before ‘...’ token decltype(auto) emit(type_trait_take_t<T_arg>... a) const ^~~ /usr/local/include/sigc++-3.0/sigc++/signal.h:451:47: error: expected ‘)’ before ‘...’ token /usr/local/include/sigc++-3.0/sigc++/signal.h: In member function ‘decltype(auto) sigc::signal_with_accumulator<T_return, T_accumulator, T_arg>::operator()(sigc::type_trait_take_t<T_arg>...) const’: /usr/local/include/sigc++-3.0/sigc++/signal.h:460:61: error: expected binary operator before ‘)’ token return emit(std::forward<type_trait_take_t<T_arg>>(a)...); ^ /usr/local/include/sigc++-3.0/sigc++/signal.h: In member function ‘decltype(auto) sigc::signal_with_accumulator<T_return, T_accumulator, T_arg>::make_slot() const’: /usr/local/include/sigc++-3.0/sigc++/signal.h:474:86: error: expected unqualified-id before ‘)’ token typename internal::member_method_result<decltype(&signal_with_accumulator::emit)>::type; ^ /usr/local/include/sigc++-3.0/sigc++/signal.h:474:87: error: template argument 1 is invalid typename internal::member_method_result<decltype(&signal_with_accumulator::emit)>::type; ^ /usr/local/include/sigc++-3.0/sigc++/signal.h:475:30: error: there are no arguments to ‘result_type’ that depend on a template parameter, so a declaration of ‘result_type’ must be available [-fpermissive] return bound_mem_functor<result_type (signal_with_accumulator::*)(type_trait_take_t<T_arg>...) ^~~~~~~~~~~ /usr/local/include/sigc++-3.0/sigc++/signal.h:475:30: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /usr/local/include/sigc++-3.0/sigc++/signal.h:477:34: error: template argument 1 is invalid type_trait_take_t<T_arg>...>(*this, &signal_with_accumulator::emit); ^ /usr/local/include/sigc++-3.0/sigc++/signal.h:477:73: error: expected unqualified-id before ‘)’ token type_trait_take_t<T_arg>...>(*this, &signal_with_accumulator::emit); ^ In file included from /usr/local/include/dbus-cxx-2.0/dbus-cxx/connection.h:23:0, from /usr/local/include/dbus-cxx-2.0/dbus-cxx.h:28, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbus.h:10, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbusserver.h:8, from ../../SIMULinho/SIMULinho_UI/main.cpp:3: /usr/local/include/dbus-cxx-2.0/dbus-cxx/signalproxy.h: In member function ‘DBus::HandlerResult DBus::SignalProxy<void(T_arg ...)>::on_dbus_incoming(std::shared_ptr<const DBus::SignalMessage>)’: /usr/local/include/dbus-cxx-2.0/dbus-cxx/signalproxy.h:117:43: error: expected unqualified-id before ‘,’ token std::apply( &SignalProxy::emit, std::tuple_cat( std::make_tuple( this ), tup_args ) ); ^ In file included from /usr/include/i386-linux-gnu/qt5/QtCore/qobject.h:46:0, from /usr/include/i386-linux-gnu/qt5/QtCore/QObject:1, from ../../SIMULinho/SIMULinho_UI/simulinho.h:4, from ../../SIMULinho/SIMULinho_UI/main.cpp:1: /usr/local/include/dbus-cxx-2.0/dbus-cxx/interface.h: At global scope: /usr/local/include/dbus-cxx-2.0/dbus-cxx/interface.h:232:20: error: expected unqualified-id before ‘public’ const Signals& signals(); ^ In file included from /usr/local/include/dbus-cxx-2.0/dbus-cxx.h:34:0, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbus.h:10, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbusserver.h:8, from ../../SIMULinho/SIMULinho_UI/main.cpp:3: /usr/local/include/dbus-cxx-2.0/dbus-cxx/interface.h:232:18: error: expected ‘;’ at end of member declaration const Signals& signals(); ^ /usr/local/include/dbus-cxx-2.0/dbus-cxx/interface.h:232:27: error: expected ‘:’ before ‘(’ token const Signals& signals(); ^ /usr/local/include/dbus-cxx-2.0/dbus-cxx/interface.h:232:28: error: expected unqualified-id before ‘)’ token const Signals& signals(); ^ In file included from /usr/local/include/dbus-cxx-2.0/dbus-cxx/interfaceproxy.h:29:0, from /usr/local/include/dbus-cxx-2.0/dbus-cxx.h:35, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbus.h:10, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbusserver.h:8, from ../../SIMULinho/SIMULinho_UI/main.cpp:3: /usr/local/include/dbus-cxx-2.0/dbus-cxx/propertyproxy.h: In member function ‘void DBus::PropertyProxy<T_type>::parentUpdated(DBus::Variant)’: /usr/local/include/dbus-cxx-2.0/dbus-cxx/propertyproxy.h:133:30: error: expected unqualified-id before ‘(’ token m_signal_changed.emit( t ); ^ In file included from /usr/include/i386-linux-gnu/qt5/QtCore/qobject.h:46:0, from /usr/include/i386-linux-gnu/qt5/QtCore/QObject:1, from ../../SIMULinho/SIMULinho_UI/simulinho.h:4, from ../../SIMULinho/SIMULinho_UI/main.cpp:1: /usr/local/include/dbus-cxx-2.0/dbus-cxx/interfaceproxy.h: At global scope: /usr/local/include/dbus-cxx-2.0/dbus-cxx/interfaceproxy.h:176:20: error: expected unqualified-id before ‘public’ const Signals& signals() const; ^ In file included from /usr/local/include/dbus-cxx-2.0/dbus-cxx.h:35:0, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbus.h:10, from ../../SIMULinho/SIMULinho_LIB_DBus/simulinhodbusserver.h:8, from ../../SIMULinho/SIMULinho_UI/main.cpp:3: /usr/local/include/dbus-cxx-2.0/dbus-cxx/interfaceproxy.h:176:18: error: expected ‘;’ at end of member declaration const Signals& signals() const; ^ /usr/local/include/dbus-cxx-2.0/dbus-cxx/interfaceproxy.h:176:27: error: expected ‘:’ before ‘(’ token const Signals& signals() const; ^ /usr/local/include/dbus-cxx-2.0/dbus-cxx/interfaceproxy.h:176:28: error: expected unqualified-id before ‘)’ token const Signals& signals() const; ^ ../../SIMULinho/SIMULinho_UI/main.cpp: In function ‘int main(int, char**)’: ../../SIMULinho/SIMULinho_UI/main.cpp:62:47: error: ‘getInstance’ is not a member of ‘SIMULinhoServer’ SIMULinhoServer *server= SIMULinhoServer::getInstance(); ^~~~~~~~~~~ Makefile:427: recipe for target 'main.o' failed
Sig C++ is incompatible with QT5.9.5, Note that I tried to force the use of C++17 by passing the
-std=gnu++17
option directly to G++, but the error occurs anyway. -
@Carlos-Delfino It seems that the library uses "signals" and "slots" within the code conflicting with Qt. One possible is to add
CONFIG += no_keywords
in the .pro. And if in your code you are using signals and slots then you change it toQ_SIGNALS
andQ_SLOTS
andQ_EMIT
. For more information read https://doc.qt.io/qt-5/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots -
@eyllanesc said in DBus C++ and Sig C++ does not compile on Qt Creator 4.5.2 Based on Qt 5.9.5 (GCC 7.3.0, 32 bit):
Q_SIGNALS
Thanks @eyllanesc , perfect!