[Interest] Q_OS_ANDROID macro

Scott Aron Bloom scott.bloom at onshorecs.com
Wed Feb 4 19:06:16 CET 2015


A typical solution for this problem, is to derive from the class.  And have the bonjour functionally only compiled/linked/moc’ed etc when its available.

Scott

From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of Nuno Santos
Sent: Wednesday, February 04, 2015 2:21 AM
To: Reinhardt Behm
Cc: interest at qt-project.org
Subject: Re: [Interest] Q_OS_ANDROID macro

Hi,

Thanks for your reply.

How can I workaround this situation? Create a specific source file for Android?

Any other ideas?

Thanks,

Nuno

On 04 Feb 2015, at 10:18, Reinhardt Behm <rbehm at hushmail.com<mailto:rbehm at hushmail.com>> wrote:

On Wednesday 04 February 2015 10:05:12 Nuno Santos wrote:

Hi,

I have been faced with an awkward situation when building an app for
android:

My app uses Bonjour but that is not available on Android, so basically for
android I don’t want to include some slots in a particular class:

#ifndef Q_OS_ANDROID
void recordAdded(const BonjourRecord &record);
void recordRemoved(const BonjourRecord &record);
void bonjourRecordResolved(const QHostInfo &hostInfo, int port);
#endif

When compiling for Android, moc file as complaining about not having the
implementation of the methods above which means that the preprocessor has
passed over Q_OS_ANDROID, however, QtCreator had that area greyed out.

Is Q_OS_ANDROID available at the time the header file is processed for moc
generation? to avoid this situation?

MOC does not understand and therefor does not respect macros and #ifdef.

--
Reinhardt


_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150204/6acb1263/attachment.html>


More information about the Interest mailing list