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. [Question] Cross platform compiler condition
Forum Updated to NodeBB v4.3 + New Features

[Question] Cross platform compiler condition

Scheduled Pinned Locked Moved Solved Mobile and Embedded
12 Posts 4 Posters 943 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
    jhayar
    wrote on last edited by jhayar
    #3

    hi thanks for the reply ,
    but my concern is not the platform condition in .pro file

    what i'm asking is the compiler options in .cpp file

    example below
    #ifndef ANDROID
    include <android/related/files.h>
    #elseif IOS
    include <ios/releated/files.h>

    thanks :)

    jsulmJ 1 Reply Last reply
    0
    • J jhayar

      hi thanks for the reply ,
      but my concern is not the platform condition in .pro file

      what i'm asking is the compiler options in .cpp file

      example below
      #ifndef ANDROID
      include <android/related/files.h>
      #elseif IOS
      include <ios/releated/files.h>

      thanks :)

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @jhayar Use scopes and DEFINES:

      win32:DEFINES += USE_MY_STUFF
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      0
      • jsulmJ jsulm

        @jhayar Use scopes and DEFINES:

        win32:DEFINES += USE_MY_STUFF
        
        J Offline
        J Offline
        jhayar
        wrote on last edited by
        #5

        @jsulm said in [Question] Cross platform compiler condition:

        @jhayar Use scopes and DEFINES:

        win32:DEFINES += USE_MY_STUFF
        

        Hi , is this for cpp file ?

        jsulmJ 1 Reply Last reply
        0
        • J jhayar

          @jsulm said in [Question] Cross platform compiler condition:

          @jhayar Use scopes and DEFINES:

          win32:DEFINES += USE_MY_STUFF
          

          Hi , is this for cpp file ?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #6

          @jhayar No, see https://doc.qt.io/qt-6/qmake-variable-reference.html#defines

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          0
          • jsulmJ jsulm

            @jhayar No, see https://doc.qt.io/qt-6/qmake-variable-reference.html#defines

            J Offline
            J Offline
            jhayar
            wrote on last edited by
            #7

            @jsulm said in [Question] Cross platform compiler condition:

            @jhayar No, see https://doc.qt.io/qt-6/qmake-variable-reference.html#defines

            hi , if that is not on the c++ level, that is not what i'm looking for

            i'm looking for something like this
            ee487513-db15-4ee7-9619-764747e3b379-image.png

            is there something similar on that ?

            so when i run the compiler, it will compile according to the platform defined ?

            Thanks :)

            jsulmJ 1 Reply Last reply
            0
            • J jhayar

              @jsulm said in [Question] Cross platform compiler condition:

              @jhayar No, see https://doc.qt.io/qt-6/qmake-variable-reference.html#defines

              hi , if that is not on the c++ level, that is not what i'm looking for

              i'm looking for something like this
              ee487513-db15-4ee7-9619-764747e3b379-image.png

              is there something similar on that ?

              so when i run the compiler, it will compile according to the platform defined ?

              Thanks :)

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @jhayar Please read the documentation!
              What I posted is EXACTLY what you are looking for!
              This in pro file:

              win32:DEFINES += USE_MY_STUFF
              

              means you can do in cpp file:

              #ifdef USE_MY_STUFF
              

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              J 1 Reply Last reply
              1
              • jsulmJ jsulm

                @jhayar Please read the documentation!
                What I posted is EXACTLY what you are looking for!
                This in pro file:

                win32:DEFINES += USE_MY_STUFF
                

                means you can do in cpp file:

                #ifdef USE_MY_STUFF
                
                J Offline
                J Offline
                jhayar
                wrote on last edited by
                #9

                @jsulm said in [Question] Cross platform compiler condition:

                @jhayar Please read the documentation!
                What I posted is EXACTLY what you are looking for!
                This in pro file:

                win32:DEFINES += USE_MY_STUFF
                

                means you can do in cpp file:

                #ifdef USE_MY_STUFF
                

                got this thanks will check it again thanks :)

                JonBJ 1 Reply Last reply
                0
                • J jhayar

                  @jsulm said in [Question] Cross platform compiler condition:

                  @jhayar Please read the documentation!
                  What I posted is EXACTLY what you are looking for!
                  This in pro file:

                  win32:DEFINES += USE_MY_STUFF
                  

                  means you can do in cpp file:

                  #ifdef USE_MY_STUFF
                  

                  got this thanks will check it again thanks :)

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by
                  #10

                  @jhayar
                  Just so you know: Qt's .pro's DEFINES generates -D<symbol> argument to the compiler for each entry in it. So DEFINES += USE_MY_STUFF means -DUSE_MY_STUFF will be added on the command line, to satisfy any #ifdef USE_MY_STUFF. And of course the leading win32: means it only does this if the target in win32.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    Hi,

                    You have the full list of macros here in Qt's documentation.

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

                    J 1 Reply Last reply
                    2
                    • SGaistS SGaist

                      Hi,

                      You have the full list of macros here in Qt's documentation.

                      J Offline
                      J Offline
                      jhayar
                      wrote on last edited by
                      #12

                      @SGaist got this , thank you , will mark this as solved for now thanks a lot guys :)

                      1 Reply Last reply
                      0

                      • Login

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