[Interest] Q_NAMESPACE is not portable?

Matthew Woehlke mwoehlke.floss at gmail.com
Sat Aug 24 00:10:45 CEST 2019


Am I missing something, or is it impossible to portably use Q_NAMESPACE?

If I just use Q_NAMESPACE on its own, e.g.:

  namespace foo {
  Q_NAMESPACE
  }

...then I get unresolved externals on Linux. If I attempt the obvious fix:

  namespace foo {
  Q_NAMESPACE
  extern FOO_EXPORT const QMetaObject staticMetaObject; // Ugh
  }

...then I get 'redefinition, different linkage' errors on Windows.

Am I doing something wrong, or is it impossible to use Q_NAMESPACE
correctly without platform-specific PP conditionals?

-- 
Matthew



More information about the Interest mailing list