header files

M

markyjj

Can anybody help with the following subject please

Ive made a program in C++ and stated that there is a header file
(headerfile.h)to be used. However, when I compile the program a message
appears saying that it is unable to include the header file.

Im not sure where I actually define the header file. Can this be defined
in notepad or a directory within the program or within the same directory
as Microsoft Visual Studio, the software that am using?

Any help would be very much appreciated...thanks
 
N

Neelesh Bodas

markyjj said:
Can anybody help with the following subject please

Ive made a program in C++ and stated that there is a header file
(headerfile.h)to be used. However, when I compile the program a message
appears saying that it is unable to include the header file.

Im not sure where I actually define the header file. Can this be defined
in notepad or a directory within the program or within the same directory
as Microsoft Visual Studio, the software that am using?
You can create the header file in the same directory as that of the C++
source file and include it using doubles quotes
#include "headerfile.h"
 
D

davidrubin

Alternatively, you can include it using brackets (<>), and add a "-I"
rule telling your compiler to look in the current (or any other)
directory for header files.
 
V

Victor Bazarov

Alternatively, you can include it using brackets (<>), and add a "-I"
rule telling your compiler to look in the current (or any other)
directory for header files.

I think you're waaaaay into implementation-specific area here, and as
such, are veeeery close to off-topicality. Please confide your answers
to Standard C++ and if you do want to provide a compiler-specific
advice, always indicate what compiler you're referring to. Thanks!
 
M

markyjj

Thnaks for the advice...however, I defined the header file in the same
directory as the source code and I still get the same error message i.e
cannot indlude header file.

I include the header as "headerfile.h" in the source code and saved the
actual defined header as headerfile.h using noted pad.

Any further advice would be great..
 
V

Victor Bazarov

markyjj said:
Thnaks for the advice...however, I defined the header file in the same
directory as the source code and I still get the same error message i.e
cannot indlude header file.

I include the header as "headerfile.h" in the source code and saved the
actual defined header as headerfile.h using noted pad.

Any further advice would be great..

Seems that you're having a compiler-specific problem. Perhaps you should
consider asking in the newsgroup dedicated to that compiler. Try
'microsofot.public.vc.project_mgt' or 'microsoft.public.vc.language' for
your next query on this subject.
 
M

Marcus Kwok

markyjj said:
Thnaks for the advice...however, I defined the header file in the same
directory as the source code and I still get the same error message i.e
cannot indlude header file.

I include the header as "headerfile.h" in the source code and saved the
actual defined header as headerfile.h using noted pad.

Any further advice would be great..

<OT>
Sometimes Windows Notepad has a nasty habit of adding a ".txt" to the
end of filenames, so "headerfile.h" may have become "headerfile.h.txt".
When you save in Notepad, use double-quotes when you type the filename
(like "headerfile.h") and it won't add the extra ".txt". Also,
depending on your Explorer settings, it may hide file extensions so you
might not even see that this has happened.
</OT>
 

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
473,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top