Search code examples
c++qtgstreamerqtcoreqt-signals

Qt #define "signals" clashes with GStreamer (gst)


Qt, which seems to name everything else with an initial Q, does this: #define signals signals in qobjectdefs.h.

However, GStream, not naturally, does not imagine signals to be a reserved word and does this

struct _GDBusInterfaceInfo
{
  /*< public >*/
  volatile gint         ref_count;
  gchar                *name;
  GDBusMethodInfo     **methods;
  GDBusSignalInfo     **signals;         <==================
  GDBusPropertyInfo   **properties;
  GDBusAnnotationInfo **annotations;
};

in gdbusintrospection.h.

Am I just to assume that Qt and GStreamer don't play well together., or is there a way around this?

Note: Qt can be persuaded to #define signals signals if I don't #define Q_MOC_RUN. But that leads to problems with classes which are using

class
{
   public:
      // stuff
   signals:
      // stuff
   private:
      // stuff
};

As you might have guessed by now, I am trying to take over code from someone who is not around to support it and Google is not my friend:-(


[Update] Thanks, @IpApp fro the tip (which is not working, alas).

I have been given someone else's code. Apparently it build for target, but has never been built for unit test and I have to do that (why he mix & matched, I do not know).

When I use QT_NO_KEYWORDS in Eclipse CDT, I get errors because the class definition code does not use Q_SINGAL(S) - it uses the signals macro (which is now defined as signals) to define certain public members.

I am not allowed to alter the subsytsem code, just to mock its interfaces, but I am loathe to mock all of Qt & Glib, because of the effort.

Perhaps there is a way to use libraries for one or the other, rather than including their directories into the source path?


Solution

  • Just follow this documentation in your qmake project file:

    CONFIG += no_keywords
    

    If you are using something else than qmake, make sure that you define the following in your buildsystem:

    QT_NO_KEYWORDS
    

    Then, you need to make sure that you use Q_SIGNALS or Q_SIGNAL all over the place in your headers so that moc (meta object compiler) is still notified that it is a signal.