Results 1 to 6 of 6

Thread: preprocessor definition in QtCreator?

  1. #1
    Join Date
    Apr 2011
    Posts
    58
    Thanks
    1

    Default preprocessor definition in QtCreator?

    Hi.

    I would like to define a preprocessor.
    But not in the .pro DEFINES.
    But in my build environment?
    I'm using QtCreator and like to know how do I set the preprocessor definition in the Build Settings.
    Thanks!

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

    Default Re: preprocessor definition in QtCreator?

    You can put any processing steps you like in the build process:
    • Projects
    • Build Settings
    • Build Steps
    • Add Build step, Custom Process Step, and configure to your heart's content.

    If you intend to share the build with others and you don't capture this step in the PRO file they will have to use Qt Creator and you will have to include the Qt Creator project file.

  3. #3
    Join Date
    Apr 2011
    Posts
    58
    Thanks
    1

    Default Re: preprocessor definition in QtCreator?

    Thanks.

    So what is the keyword I could use to do a preprocessor define? In Visual C++, we just add whatever we like to define under the Preprocess entry. But in this case, what do I place in the custom build step? PREPROCESS = <whatIdefine>? Thanks again.

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

    Default Re: preprocessor definition in QtCreator?

    You put whatever actual operating system commands you want to execute into the Qt Creator build steps.

    If you want to try to roll it into the PRO file, where you have access to file names, then you should look at the custom compilers stuff in:
    http://www.qtcentre.org/wiki/index.p...e#Custom_tools
    Last edited by ChrisW67; 30th July 2011 at 09:06.

  5. #5
    Join Date
    May 2011
    Posts
    239
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60
    Thanks
    4
    Thanked 35 Times in 35 Posts

    Default Re: preprocessor definition in QtCreator?

    He is not actually trying a define a preprocessor, but preprocessor variables... (like #define _WIN32, expressed by DEFINES in .pro files).

    (And I don't know how to do it in build settings either.)

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: preprocessor definition in QtCreator?

    One can pass arbitrary statements to qmake (e.g. qmake DEFINES+=xyz) although as Chris already stated doing so in Creator's project settings one forces others to use his Creator configuration file. Adding the statements to the .pro file using the "DEFINES" variable is the proper approach.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. preprocessor output
    By kS in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2010, 22:54
  2. A question on preprocessor
    By Dante in forum Qt Programming
    Replies: 1
    Last Post: 9th July 2009, 23:28
  3. custom preprocessor?
    By magland in forum Qt Programming
    Replies: 17
    Last Post: 20th October 2007, 13:17
  4. Qt4 Preprocessor defines
    By Chicken Blood Machine in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 17:28
  5. QT & VC++ 8 preprocessor setting
    By Ngoc in forum Qt Programming
    Replies: 0
    Last Post: 3rd March 2006, 21:40

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.