[solved] Qt 5.2.0 on iOS Q_OS_IOS is not defined when running in iOS Simulator
-
In iOS simulator "MAC MAC MAC" gets written into the output.
Can anybody confirm that?
@
int main(int argc, char *argv[]) {
#if defined(Q_OS_IOS)
qDebug() << "IOS IOS IOS";
#endif
#if defined(Q_OS_MAC)
qDebug() << "MAC MAC MAC";
#endif
return 0;
}
@Same behaviour when running on device? May be Qt bug?
Would like to try that directly on the iPhone, but I am still waiting for my dev account activation. -
Hi,
There's something not clear in your post. Are you getting different result between your first and your second code example ?
-
updated my post
-
Someone wrote (Don't know, why it is not visible here anymore)
bq. "It's not a bug, Q_OS_MAC is for OS X and Q_OS_IOS is for iOS"
How should one differentiate if the application is running on OSX or iOS (simulator) if one uses OSX and iOS simulator only? I expected a real simulation of being on the iPad/ iPhone. This seems to be currently not supported by this #define.
-
That someone was me, before I saw your corrections and the X missing.
Here's the explanation:
Q_OS_MAC is for Darwin type OSs, if you want to make the difference between iOS and OS X use Q_OS_MACX and Q_OS_IOS -
Nope, if I code
@
int main(int argc, char *argv[]) {
#if defined(Q_OS_IOS)
qDebug() << "IOS";
#elif defined(Q_OS_MACX)
qDebug() << "MACX";
#endif
return 0;
}
@I get the output "MACX" in both cases (on my OSX desktop and within iOS simulator) :-(
-
Q_OS_IOS seems to be undefined in iOS Simulator as the following brings no output:
@
int main(int argc, char *argv[]) {
#if defined(Q_OS_IOS)
qDebug() << "IOS";
#endif
}
@ -
Just tested (Qt built from git) and I get the correct answers
-
Okay, made a new small project and can commit, that it works.
Need to analyse, what went wrong!Sorry for that!
Germans say: "Asche auf mein Haupt!"It is crazy, in the project context it wents wrong, in a small testproject it succeeds.
Should go to bed. -
Found the cause:
@
QMAKE_CXXFLAGS += $$system(mapnik-config --cxxflags)
QMAKE_CXXFLAGS += $$system(mapnik-config --includes --dep-includes)
@have been defined in my projects .pro file.
This results into Q_OS_IOS to be undefined on iOS simulator.
@mapnik-config --cxxflags@results into
@-ansi -Wall -ftemplate-depth-300 -O3 -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts@
and
@mapnik-config --includes --dep-includes@
results into
@-I/usr/local/include -I/usr/local/include/mapnik/agg
-I/usr/local/Cellar/gdal/1.10.1/include -I/usr/local/Cellar/libtiff/4.0.3/include -I/usr/local/Cellar/proj/4.8.0/include -I/usr/local/Cellar/jpeg/8d/include -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2 -I/usr/local/Cellar/freetype/2.5.0.1/include -I/usr/local/Cellar/freetype/2.5.0.1/include/freetype2 -I/usr/local/Cellar/icu4c/52.1/include -I/usr/local/Cellar/boost/1.55.0/include -I/usr/include -I/usr/local/Cellar/libpng/1.5.14/include/libpng15 -I/usr/local/Cellar/pixman/0.32.2/include/pixman-1 -I/usr/local/Cellar/glib/2.38.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.38.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/cairo/1.12.16/include/cairo@on my computer.