Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

#Include Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
superchief - 06 May 2005 14:08 GMT
I have a simple vc++ win32 program. I have one header that has a list of all
the other header files in it. In each of the .cpp files i make a referance to
this main header. is there a way of getting around this, so i only have to
make one header (listing all the includes i ever would like in the program)
and then reference this once in one main file somewhere?

I am a bit new to the c++ compiler so this doesn't appear to be obvious to me.

Thanks for your help
Jürgen Devlieghere - 06 May 2005 15:06 GMT
Well, I don't think there is a way to avoid including your
'superchief-include-file', since the compiler must get it's definitions
somewhere.

On the other hand, putting all possible includes is not very nice, certainly
not in bigger projects: 1 change in some include file makes a full
recompilation necessary, since the compiler can no longer see the
dependencies.

Jürgen Devlieghere
>I have a simple vc++ win32 program. I have one header that has a list of
>all
[quoted text clipped - 9 lines]
>
> Thanks for your help
Jochen Kalmbach [MVP] - 06 May 2005 15:47 GMT
Hi Jürgen!
> On the other hand, putting all possible includes is not very nice, certainly
> not in bigger projects: 1 change in some include file makes a full
> recompilation necessary, since the compiler can no longer see the
> dependencies.

But it is a very good aproch if your use precompiled headers. Then you
normally only need *one* include file (stdafx.h; which contains
everything you need) and the compile-time is very fast...

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/

John Gabriel - 06 May 2005 16:34 GMT
Yes. I think you can do this easily - Just use a preprocessor directive so
that the include files are processed only once, i.e

#ifndef ALL_INCLUDED
#include "h1.h"
#include "h2.h"
#define  ALL_INCLUDED
#endif

Or maybe I misunderstood your question?

> I have a simple vc++ win32 program. I have one header that has a list of all
> the other header files in it. In each of the .cpp files i make a referance to
[quoted text clipped - 5 lines]
>
> Thanks for your help
superchief - 07 May 2005 19:24 GMT
I will try this method and see if it works, thanks.

Also thanks to Jurgen and Jochen for their help

> Yes. I think you can do this easily - Just use a preprocessor directive so
> that the include files are processed only once, i.e
[quoted text clipped - 16 lines]
> >
> > Thanks for your help

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.