DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Includes

  1. #1
    Gav Guest

    Includes


    I am trying to make a Code Library with all my most used functions in so I
    can just include them and use them. The problem is when a program includes
    an include that also includes something that has already been included (tongue
    twister).

    ie.
    Program A - Includes B and C.

    But include B also includes C. So when the program tries to include C it
    has already been included. Is there any way of detecting what has already
    been included?

    Cheers Gav

  2. #2
    Michael Foster Guest

    Re: Includes


    "Gav" <gavin.metcalfe@portakabin.com> wrote in message
    news:3ac85218$1@news.devx.com...
    >
    > I am trying to make a Code Library with all my most used functions in so I
    > can just include them and use them. The problem is when a program includes
    > an include that also includes something that has already been included

    (tongue
    > twister).
    >
    > ie.
    > Program A - Includes B and C.
    >
    > But include B also includes C. So when the program tries to include C it
    > has already been included. Is there any way of detecting what has already
    > been included?
    >
    > Cheers Gav



    The same way we do it with C programming. At the top of each file, define a
    variable or constant. Before including that file, check for the existence of
    that variable - if it exists don't include that file.

    Mike
    www.cross-browser.com




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center