<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Using glib and gtk with Qt]]></title><description><![CDATA[<p dir="auto">I have a common project which is developed using glib, gtk and some other libraries. I will use this common project's headers&amp;source files in my project. I added required <code>PKGCONFIG</code>s to my <code>.pro</code> file. It builds succesfully. But when i include header files of common project to my project and try to build project:</p>
<pre><code>/usr/include/qt6/QtCore/qtmetamacros.h:45:20: error: expected unqualified-id before ‘public’
   45 | # define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal)
      |                    ^~~~~~
/usr/include/qt6/QtCore/qtmetamacros.h:41:22: note: in expansion of macro ‘Q_SIGNALS’
   41 | #     define signals Q_SIGNALS
      |                      ^~~~~~~~~
/usr/include/glib-2.0/gio/gdbusintrospection.h:157:25: note: in expansion of macro ‘signals’
  157 |   GDBusSignalInfo     **signals;
      |                         ^~~~~~~
/usr/include/qt6/QtCore/qtmetamacros.h:45:20: error: expected unqualified-id before ‘public’
   45 | # define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal)
      |                    ^~~~~~
/usr/include/qt6/QtCore/qtmetamacros.h:41:22: note: in expansion of macro ‘Q_SIGNALS’
   41 | #     define signals Q_SIGNALS
      |                      ^~~~~~~~~
/usr/include/gtk-3.0/gtk/gtkbindings.h:103:21: note: in expansion of macro ‘signals’
  103 |   GtkBindingSignal *signals;
      |                     ^~~~~~~
</code></pre>
<p dir="auto">I saw a thing <code>CONFIG += no_keywords</code>, that can maybe solve the problem(i didnt try it yet) but i will need to change all signal, slot, emit keywords in my project. Any better way? And why this happening? Because of glib use same keywords or something?</p>
]]></description><link>https://forum.qt.io/topic/142146/using-glib-and-gtk-with-qt</link><generator>RSS for Node</generator><lastBuildDate>Tue, 06 Oct 2026 17:53:47 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/142146.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Jan 2023 08:35:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Using glib and gtk with Qt on Fri, 13 Jan 2023 07:11:28 GMT]]></title><description><![CDATA[<p dir="auto">By the way easiest solution i found is: adding <code>#undef signals</code> before glib includes, and after it <code>#define signals</code> again.</p>
]]></description><link>https://forum.qt.io/post/743689</link><guid isPermaLink="true">https://forum.qt.io/post/743689</guid><dc:creator><![CDATA[masa4]]></dc:creator><pubDate>Fri, 13 Jan 2023 07:11:28 GMT</pubDate></item><item><title><![CDATA[Reply to Using glib and gtk with Qt on Fri, 13 Jan 2023 04:30:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> Thank you, that was what i found. So only easy option is converting signal slots to their macro names.</p>
]]></description><link>https://forum.qt.io/post/743674</link><guid isPermaLink="true">https://forum.qt.io/post/743674</guid><dc:creator><![CDATA[masa4]]></dc:creator><pubDate>Fri, 13 Jan 2023 04:30:05 GMT</pubDate></item><item><title><![CDATA[Reply to Using glib and gtk with Qt on Fri, 13 Jan 2023 04:28:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stryga42">@<bdi>stryga42</bdi></a> I wont use gtk for my UI, but the common project includes gtk, and uses it in inner test programs. I am not sure how can i isolate them. Thanks anyway.</p>
]]></description><link>https://forum.qt.io/post/743673</link><guid isPermaLink="true">https://forum.qt.io/post/743673</guid><dc:creator><![CDATA[masa4]]></dc:creator><pubDate>Fri, 13 Jan 2023 04:28:29 GMT</pubDate></item><item><title><![CDATA[Reply to Using glib and gtk with Qt on Thu, 12 Jan 2023 17:31:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/masa4">@<bdi>masa4</bdi></a> To add to <a class="plugin-mentions-user plugin-mentions-a" href="/user/stryga42">@<bdi>stryga42</bdi></a> take a look at <a href="https://doc.qt.io/qt-5/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots</a></p>
]]></description><link>https://forum.qt.io/post/743629</link><guid isPermaLink="true">https://forum.qt.io/post/743629</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Thu, 12 Jan 2023 17:31:56 GMT</pubDate></item><item><title><![CDATA[Reply to Using glib and gtk with Qt on Thu, 12 Jan 2023 17:28:47 GMT]]></title><description><![CDATA[<p dir="auto">It seems that the token <em>signals</em> is used as a variable name in glib and defined as a macro in Qt6. Since macro substitution happens very early there is not much you can do.<br />
Maybe you can isolate gtk and Qt so that Qt includes (which provide the annoying macro definition) are never processed before gtk includes  happen.<br />
General remark: Mixing direct gtk and Qt in one GUI may create "strange" results - I ran into such a problem years ago, see <a href="https://forum.qt.io/topic/121256/qt-and-opencv-on-gnome-incompatibility">this post</a>. So it may be a good idea to keep things separated anyway.</p>
]]></description><link>https://forum.qt.io/post/743628</link><guid isPermaLink="true">https://forum.qt.io/post/743628</guid><dc:creator><![CDATA[stryga42]]></dc:creator><pubDate>Thu, 12 Jan 2023 17:28:47 GMT</pubDate></item></channel></rss>