Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [solved] Qt 5.2.0 on iOS Q_OS_IOS is not defined when running in iOS Simulator
Forum Updated to NodeBB v4.3 + New Features

[solved] Qt 5.2.0 on iOS Q_OS_IOS is not defined when running in iOS Simulator

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 2 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jraichouni
    wrote on 6 Jan 2014, 20:50 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Jan 2014, 20:54 last edited by
      #2

      Hi,

      There's something not clear in your post. Are you getting different result between your first and your second code example ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jraichouni
        wrote on 6 Jan 2014, 20:59 last edited by
        #3

        updated my post

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jraichouni
          wrote on 6 Jan 2014, 21:11 last edited by
          #4

          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.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 6 Jan 2014, 21:22 last edited by
            #5

            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

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jraichouni
              wrote on 6 Jan 2014, 22:00 last edited by
              #6

              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) :-(

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jraichouni
                wrote on 6 Jan 2014, 22:05 last edited by
                #7

                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
                }
                @

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 6 Jan 2014, 22:09 last edited by
                  #8

                  Just tested (Qt built from git) and I get the correct answers

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jraichouni
                    wrote on 6 Jan 2014, 22:30 last edited by
                    #9

                    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.

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jraichouni
                      wrote on 6 Jan 2014, 22:41 last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0

                      1/10

                      6 Jan 2014, 20:50

                      • Login

                      • Login or register to search.
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved