Results 1 to 4 of 4

Thread: Is there a #define that tells if qtcreator is being used?

  1. #1
    Join Date
    May 2012
    Posts
    57
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Is there a #define that tells if qtcreator is being used?

    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
    Qt Code:
    1. #if (USING_QTCREATOR)
    2. ..
    3. #else
    4. ..
    5. #endif
    To copy to clipboard, switch view to plain text mode 

    Thanks.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Is there a #define that tells if qtcreator is being used?

    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).
    Last edited by ChrisW67; 19th October 2012 at 02:22.

  3. #3
    Join Date
    May 2012
    Posts
    57
    Thanks
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Is there a #define that tells if qtcreator is being used?

    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.
    Last edited by Cremers; 19th October 2012 at 11:02.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Is there a #define that tells if qtcreator is being used?

    It will be the pre-processor of GCC I think. You can see all the pre-defined macros with:
    Qt Code:
    1. touch temp.h
    2. gcc -E -dM temp.h
    To copy to clipboard, switch view to plain text mode 
    On my Linux box I get "unix" and "linux" with/without leading/trailing double underscores. Under MingW similar WIN32 variations.

Similar Threads

  1. qtcreator specific x64 define
    By Le_B in forum Qt Tools
    Replies: 1
    Last Post: 26th June 2012, 18:06
  2. Replies: 4
    Last Post: 12th June 2012, 00:44
  3. QtCreator 2.0 crashes application working in QtCreator 1.3
    By been_1990 in forum Qt Programming
    Replies: 2
    Last Post: 21st September 2010, 12:58
  4. Replies: 1
    Last Post: 2nd April 2010, 06:42
  5. #define MYCLASS_H ?
    By bnilsson in forum General Programming
    Replies: 1
    Last Post: 3rd February 2008, 10:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.