473,473 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

#Include 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
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
Nov 17 '05 #1
4 974
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
"superchief" <su********@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
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

Nov 17 '05 #2
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...
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #3
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?

"superchief" wrote:
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

Nov 17 '05 #4
I will try this method and see if it works, thanks.

Also thanks to Jurgen and Jochen for their help

"John Gabriel" wrote:
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?

"superchief" wrote:
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

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: WStoreyII | last post by:
what exactly is the difference between import and include? For Example if i had a schema called common, that had some common elements that i use such as address, phone ect. And then i created a...
3
by: Nathan Wallace | last post by:
Hello, I have 2 schema, for argument sake let's call them child.xsd and parent.xsd. I define all my types in parent.xsd and the child.xsd include the parent.xsd using the following tag: ...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
4
by: Jon | last post by:
All, I have a question regarding include files. I'm currently wanting to secure all of the pages within a directory by having a login script that queries a MySQL DB, and writes a session...
3
by: sunnylele | last post by:
Hi, all, I have a question on the use of #include: #include <unistd.h> #include <asm/unistd.h> #include "nn.h" What are the differences between the above three usages? It seems the third...
2
by: key9 | last post by:
Hi all look at the organize tree main.c ------ #include lib_adapter.c main() { foo();
3
by: Steven Edison | last post by:
I have a split container on my form, from within one of them I wish to reach the main from of the app. I'm having problems with the headers and namespaces. I want something like this: ...
2
by: Jonathan Wood | last post by:
In my application, new accounts must be created by an administrator--users will not create their own. Ideally, the user could then log on and specify their own password question and answer, and the...
3
by: aggarwv | last post by:
I am trying to compile someone else's code and compiler is giving an error on a statement #include "$INCLUDE" Can someone please tell me what this statement does? Does it mean that INCLUDE is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.