Include declarations and related definition

K

Kostas

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
 
W

White Wolf

Kostas said:
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).
 
V

Victor Bazarov

Kostas said:
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
 
G

Gary

Victor Bazarov said:
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.


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?
 
V

Victor Bazarov

Gary said:
"Victor Bazarov" <[email protected]> wrote in message

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top