Using glib in Qt meet problem.
-
I have compiled the http://gupnp.org/ source code, gupnp, gupnp-av successfully without using Qt
Then I port gupnp-tools to QT, and it will link gupnp and gupnp-av, but meet a problem.The gupnp is based on GObject, and It will use the GDBusInterfaceInfo class which is declared as below:
struct _GDBusInterfaceInfo
{
...
GDBusSignalInfo **signals;
...
}
Here is the conflict with Qt signals, thus compile failed.any ideas?
-
maybe wrapping gupnp class/structs/objects definitions into separate namespace will make a trick?!
-
fix it:
using
#define QT_NO_KEYWORDS
in every file where you have that problem. -
Since you have a solution, please mark your post with [Solved] .
-
Hi @xhsoldier , could you share your port of gupnp-tools to QT please?
-
add CONFIG += no_keywords in your *.pro
all uses of the macros have to be replace by Q_xxx -
I have found better and more convenient solution.
You should do only one thing - include your glib headers before Qt headers - so it's unaffected by Qt defines.
Using this approach, you don't need to change macro names and anything else.