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

C++: compiling header files

P: n/a
A
Hi,

Can you actually compile header files? I'm writing a header file named
"test.h" using Visual C++ 6.0 and I get the following error message when I
try to compile it:

"no compile tool associated with this file extension".

Anyway, I thought the compiler will just do a syntax check, but it seems it
doesn't like it. Any comments appreciated.

side note: what does precompiled header mean?
Regards,
A
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
A wrote:
Hi,

Can you actually compile header files? I'm writing a header file named
"test.h" using Visual C++ 6.0 and I get the following error message when I
try to compile it:

"no compile tool associated with this file extension".

Anyway, I thought the compiler will just do a syntax check, but it seems it
doesn't like it. Any comments appreciated.

side note: what does precompiled header mean?
Regards,
A


Some compilers allow precompiled headers.
When a compiler "precompiles" a header, it parses the text and
stores the relevant information (definitions & declarations)
in file for later usage. Next time the compiler encounters
the header file, it doesn't need to parse the text again;
it just uses the definitions that it stored away.

The precompilation step is supposed to speed up the
compilation process, especially for large header files
{like those encountered for MS Windows). Although there
is no standard for precompilation, some compilers give
out warnings, such as "Cannot precompile header: code
in header". I encounter this when I declare default values
in constructs. When this happens, is precompilation really
a feature? Hmmm.
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Jul 19 '05 #2

P: n/a
On Tue, 28 Oct 2003 22:31:06 +1030, "A" <A@iprimus.com.au> wrote in
comp.lang.c++:
Hi,

Can you actually compile header files? I'm writing a header file named
"test.h" using Visual C++ 6.0 and I get the following error message when I
try to compile it:

"no compile tool associated with this file extension".

Anyway, I thought the compiler will just do a syntax check, but it seems it
doesn't like it. Any comments appreciated.

side note: what does precompiled header mean?
Regards,
A


The reason that you can't compile a file named "test.h" with your
particular compiler has to do with the setup and features of your
particular compiler's IDE. There is nothing in the language that
prevents this, although of course your header might not be a complete,
valid translation unit on it's own.

Either ask in one of Microsoft's support groups on
msnews.microsoft.com to find out how to set your IDE to compile files
like this, or try from a command prompt and use the command line
compiler.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.