PDA

View Full Version : Is there a #define that tells if qtcreator is being used?



Cremers
18th October 2012, 20:17
I'm coding on qtcreator on ubuntu as well as on a compiler using qt on android. Is there a define I can use to distinguish between the two? Like


#if (USING_QTCREATOR)
..
#else
..
#endif


Thanks.

ChrisW67
19th October 2012, 02:15
Is there a #define that tells if qtcreator is being used?
No. How would that be useful?

Edit: I reread your actual question. Telling the difference between platforms has nothing to do with Qt Creator. There are macros in QtGlobal named Q_OS_* and Q_WS_* for this purpose. I don't know whether Necessitas (I assume that's what you are using because out-of-the-box Qt does not do Android) defines something similar. Failing that you can usually use the default macros defined by your compiler (which is what Qt is doing under the lid).

Cremers
19th October 2012, 07:37
Yes it's necessitas with the c4droid app which uses gcc under the hood. I asked the writer of that app if there's something I can use. Thanks.

Edit: if anyone's curious, one can use #ifdef __ANDROID__
Dunno if this is defined by necessitas or by c4droid, but it works.

ChrisW67
19th October 2012, 22:31
It will be the pre-processor of GCC I think. You can see all the pre-defined macros with:


touch temp.h
gcc -E -dM temp.h

On my Linux box I get "unix" and "linux" with/without leading/trailing double underscores. Under MingW similar WIN32 variations.