[Question] Cross platform compiler condition
-
Hi, would like to ask the list of compiler condition so that the compiler knows what headers are related for the platform
Android = Q_WS_ANDROID ?? is this correct ? if yes how about other platform thanks
iOS
Mac
Windows
Linux@jhayar Not sure I understood your question.
Take a look at https://doc.qt.io/qt-6/qmake-language.html "Platform Scope Values". -
hi thanks for the reply ,
but my concern is not the platform condition in .pro filewhat 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 :)
-
hi thanks for the reply ,
but my concern is not the platform condition in .pro filewhat 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 :)
-
@jsulm said in [Question] Cross platform compiler condition:
@jhayar Use scopes and DEFINES:
win32:DEFINES += USE_MY_STUFF
Hi , is this for cpp file ?
-
@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
is there something similar on that ?
so when i run the compiler, it will compile according to the platform defined ?
Thanks :)
-
@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
is there something similar on that ?
so when i run the compiler, it will compile according to the platform defined ?
Thanks :)
-
@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
@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 :)
-
@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 :)
@jhayar
Just so you know: Qt's.pro
'sDEFINES
generates-D<symbol>
argument to the compiler for each entry in it. SoDEFINES += 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 leadingwin32:
means it only does this if the target inwin32
. -
Hi,
You have the full list of macros here in Qt's documentation.
-
Hi,
You have the full list of macros here in Qt's documentation.