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>
This commit is contained in:
parent
18b7015e86
commit
f2b6307af2
@ -44,6 +44,10 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(__OBJC__) && !defined(__cplusplus)
|
||||
# warning "File built in Objective-C mode (.m), but using Qt requires Objective-C++ (.mm)"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user