Results 1 to 2 of 2

Thread: #define MYCLASS_H ?

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default #define MYCLASS_H ?

    In many of the Qt example headers it starts with something like this:

    Qt Code:
    1. #ifndef MYCLASS_H
    2. #define MYCLASS_H
    3.  
    4. #include ....
    5.  
    6. class myClass : public QSomeClass
    7. {
    8. ...
    9. };
    To copy to clipboard, switch view to plain text mode 

    What is the meaning and purpouse of the MYCLASS_H definitions?
    I have noticed that it does not compile if they don't have the same name as the class in the file.
    MacOSX user dabbling with Linux and Windows.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: #define MYCLASS_H ?

    See Wikipedia: Include guard
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    bnilsson (3rd February 2008)

Similar Threads

  1. Macro used for debugging
    By sunil.thaha in forum General Programming
    Replies: 11
    Last Post: 30th March 2007, 17:32
  2. how to define the callback function in QThread?
    By cxl2253 in forum Qt Programming
    Replies: 6
    Last Post: 30th March 2007, 10:59
  3. Replies: 1
    Last Post: 4th November 2006, 06:53
  4. QtSingleApplication
    By mule in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 19:21
  5. define column in designer QT4.1.1
    By raphaelf in forum Qt Tools
    Replies: 2
    Last Post: 26th February 2006, 20:30

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.