×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Nokia Developer Champion
    Join Date
    Aug 2010
    Location
    Ahmedabad
    Posts
    299

    Question #include <> vs #include ""

    Hello Everyone,

    I am new to Qt programing. I have seen following two different syntax to include files.

    #include <Class>


    and

    #include "HeaderFile.h"

    I could not get the fundamental difference between this two syntax. I understand that the first one include the class and second one includes the header file. But I am unable to understand which syntax to use in different circumstances.Which syntax consumes more memory ?

    Many thanks in advance.
    Regards,

    Girish Padia

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: #include <> vs #include ""

    here's one answer: http://www.geekpedia.com/KB113_What-...otandquot.html

    Basically you would use "" for local includes

  3. #3
    Nokia Developer Champion
    Join Date
    Aug 2010
    Location
    Ahmedabad
    Posts
    299

    Re: #include <> vs #include ""

    Thanks symbianyucca,

    The link explains the difference for C++. How Qt interpretes both ? Because I have seen following syntax in Qt Examples.

    #ifdef Q_OS_SYMBIAN
    #include "qsysteminfo.h"
    #else
    #include <QSysInfo>
    #endif

    Does it depend on the target device to compile ?
    Regards,

    Girish Padia

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: #include <> vs #include ""

    QT is C++ in the end, so would consider it to work same way. Though your example, appears to say that Symbian version would not make any difference on them. Anyway for future compatibility, it would be better to stick on doing it as it should be done..

  5. #5
    Nokia Developer Champion
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: #include <> vs #include ""

    "<>" is used for the standard header files -- searches a "wired in" list of headers -- while "" searches both the standard header file list and the list of header files supplied by the complier user (or the toolkit). In general one can use "" instead of <>, so long as the header file being referenced isn't duplicated in the user-supplied list (which is generally a bad idea anyway). Using <> instead of "" is less likely to work, however.

    (The whole thing is really a little bit silly, and if it were done all over again it's likely that a different scheme would be used -- either no distinction at all or a finer-grained distinction.)

    Note that this has nothing to do with whether the header file ends in ".h" or not -- if you look at the "QSysInfo" (no ".h") header file, for instance, it's just a #include for another header file (this one with ".h").

Similar Threads

  1. can DIALOG include "item" and "form" both?
    By RichieChyi in forum Symbian
    Replies: 2
    Last Post: 2008-05-08, 10:29
  2. Replies: 1
    Last Post: 2005-08-03, 09:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •