By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,836 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

Include declarations and related definition

P: n/a
Hello, I just need to get something straight in my mind. In
microsoft's VC compiler, whenever I include an .h file it should go
into my stdafx.h file. Then every cpp file needs to include the
stdafx.h file so I don't get the precompiled header directive
something message. What happens to the cpp file with definitions of
whatever is declared in the h file. Do I just add it to the project?
Maybe I'm saying it all wrong? Cheers

Kostas
Jul 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Kostas wrote:
Hello, I just need to get something straight in my mind. In
microsoft's VC compiler, whenever I include an .h file it should go
into my stdafx.h file. Then every cpp file needs to include the
stdafx.h file so I don't get the precompiled header directive
something message. What happens to the cpp file with definitions of
whatever is declared in the h file. Do I just add it to the project?
Maybe I'm saying it all wrong? Cheers


You will need to ask it in a Microsoft Visual C++ programming newsgroup.
The whole stdafx magic is Microsoft propriatery extension (and I start
always by switching it off).

--
WW aka Attila
:::
The difference between ignorance and apathy? I don't know, and I couldn't
care less...
Jul 22 '05 #2

P: n/a
"Kostas" <sk*******@hotmail.com> wrote...
Hello, I just need to get something straight in my mind. In
microsoft's VC compiler, whenever I include an .h file it should go
into my stdafx.h file.
No.
Then every cpp file needs to include the
stdafx.h file so I don't get the precompiled header directive
something message.
That's specific to their way of organising precompiled headers.
You are completely free to turn that feature off. See the VC++
help to learn how to do it.
What happens to the cpp file with definitions of
whatever is declared in the h file. Do I just add it to the project?
Usually.
Maybe I'm saying it all wrong? Cheers


Not all of it, anyway. You could ask more on those compiler
options in microsoft.public.vc.language -- a newsgroup for
questions specific to VC++. Here they are OT, I'm afraid.

Victor
Jul 22 '05 #3

P: n/a
"Victor Bazarov" <v.********@comAcast.net> wrote in message news:<O48yb.358939$Fm2.358821@attbi_s04>...
"Kostas" <sk*******@hotmail.com> wrote...
Hello, I just need to get something straight in my mind. In
microsoft's VC compiler, whenever I include an .h file it should go
into my stdafx.h file.


No.
Then every cpp file needs to include the
stdafx.h file so I don't get the precompiled header directive
something message.


That's specific to their way of organising precompiled headers.
You are completely free to turn that feature off. See the VC++
help to learn how to do it.
What happens to the cpp file with definitions of
whatever is declared in the h file. Do I just add it to the project?


Usually.


If the cpp file is not application specific but is a utility routine,
it is usually not added to the project. Once compiled (separately) the
library containing the object file is pointed to when running the
linker (-L switch?) and the specific object file is pointed to when
running the linker (-l switch?) so that it is linked into the
executable.

Isn't that the way?
--
Gary
Jul 22 '05 #4

P: n/a
"Gary" <gl*******@comcast.net> wrote...
"Victor Bazarov" <v.********@comAcast.net> wrote in message news:<O48yb.358939$Fm2.358821@attbi_s04>...
"Kostas" <sk*******@hotmail.com> wrote...
Hello, I just need to get something straight in my mind. In
microsoft's VC compiler, whenever I include an .h file it should go
into my stdafx.h file.


No.
Then every cpp file needs to include the
stdafx.h file so I don't get the precompiled header directive
something message.


That's specific to their way of organising precompiled headers.
You are completely free to turn that feature off. See the VC++
help to learn how to do it.
What happens to the cpp file with definitions of
whatever is declared in the h file. Do I just add it to the project?


Usually.


If the cpp file is not application specific but is a utility routine,
it is usually not added to the project. Once compiled (separately) the
library containing the object file is pointed to when running the
linker (-L switch?)


There are no switches defined by the language Standard (except the
'switch' statement).
and the specific object file is pointed to when
running the linker (-l switch?) so that it is linked into the
executable.

Isn't that the way?


It's not _the_ way. It's _a_ way. If your "utility routine" is
a function (or a class) template, there is no library to put it in,
you _usually_ give it to the compiler at the compilation stage.

Then again, there is that "export" keyword, which I'm yet to use in
my programming activities...

Victor
Jul 22 '05 #5

P: n/a
Thanks for the feedback, I'll refer to the right group.
Jul 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.