Results 1 to 3 of 3

Thread: Defines

  1. #1
    Join Date
    Jun 2011
    Posts
    203
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Defines

    When I write defines, does each define have to be a unique number?

    e.g.

    Qt Code:
    1. //Colours
    2. #define RED 1
    3. #define BLUE 2
    4.  
    5. //Text Size
    6. #define CAPITAL 1
    7. #define LOWERCASE 2
    To copy to clipboard, switch view to plain text mode 

    or do you have to make sure that each define has a unique value?

  2. #2
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Defines

    Hey, this is very basic. Take a look into C/C++ Preprocessor.
    ~ We are nothing in this universe ~

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Defines

    Not required, they way you define above is valid
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. QMake DEFINES
    By AlHadr in forum Qt Tools
    Replies: 7
    Last Post: 25th January 2013, 10:55
  2. Which defines to use for which platform Q_OS_ ...
    By hubbobubbo in forum Qt Programming
    Replies: 1
    Last Post: 1st June 2010, 10:58
  3. Date defines in Sqlite?
    By Raccoon29 in forum General Programming
    Replies: 1
    Last Post: 23rd November 2009, 23:14
  4. Passing global defines to moc
    By NTwoO in forum Qt Programming
    Replies: 6
    Last Post: 2nd April 2007, 11:23
  5. Qt4 Preprocessor defines
    By Chicken Blood Machine in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 16:28

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.