summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobjectdefs.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-01-28 16:31:49 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-30 13:29:32 +0100
commitf2b6307af2895d312670a5ee6781ef8f1b46d799 (patch)
tree78af1fbf697c7d3d919302b758fd352127bdeb87 /src/corelib/kernel/qobjectdefs.h
parent18b7015e86bf621df1f54beb474d67123e18f0ae (diff)
Warn the user when compiling Objective-C files (.m) that includes Qt
Xcode project templates will by default create source files that ends with .m (obj-c). If you try to include Qt from such files, you will get a bunch of compile errors, since the compiler will not understand C++ concepts, such as namespaces. To ease mixing native iOS and OS X apps with Qt, we print a warning to the console, so that the error messages are easier to understand and fix, by renaming the offending file to .mm. Change-Id: I192f460f9ca53145b7193dec1cfe7c095ae149a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qobjectdefs.h')
-rw-r--r--src/corelib/kernel/qobjectdefs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index c3141c1abb..fe107f1425 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -42,6 +42,10 @@
#ifndef QOBJECTDEFS_H
#define QOBJECTDEFS_H
+#if defined(__OBJC__) && !defined(__cplusplus)
+# warning "File built in Objective-C mode (.m), but using Qt requires Objective-C++ (.mm)"
+#endif
+
#include <QtCore/qnamespace.h>
#include <QtCore/qobjectdefs_impl.h>