[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
CInclude

(C) #include

A  ?preprocessor statement to add a header file (.h or .hpp) or other files to your program.

There are two different header file #includes:

  1. include <stdio.h> // 1: Standard header file
  2. include "MyHeader.h" // 2: Local


The first #include means that the header is a standard header file. The second #include means that the file is local, i.e. in the same directory as the program. If the local #include fails, the standard header file directory is checked for this header file.

Never #include unnecessary header files. Never #include a header when a  ?forward declaration will suffice [3].

Implementation (.c) files

These normally are not #included. Instead, these are added to your project. For example, in C++ Builder, select 'Project | Add to Project'.

Forgetting to add an implementation file to you project results in a  ?linking error.

'#include' links



last edited (November 17, 2006) by bilderbikkel, Number of views: 1048, Current Rev: 1

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.