Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Beginner
Hi!
Please tell me how one can create a header or .h file in C++.
Please help me.
 
Thanks in advance!
Posted 19-Jan-10 6:13am
Edited 22-Jun-11 7:33am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Since a header file is plain text file, you may create it with a text file editor (like Visual C++ IDE's one) or, for instance, the notepad (I suggest you Notepad++).
However, in order to write meaningful content inside the header file you have to read (at least) a tutorial about C++ programming language.
Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You should consider buying a good C++ book before asking basic and inane questions here. We love to help, but a question like that leaves us worried what we can say, and hope you will understand it.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

If you are using Visual Studio
 
Right Click Project -> Add New Item -> Header File -> Add header file Name -> OK
 
and here is your new header file using MSVC
 

If in case you are using turbo C or GCC, use notepad
 
open notepad and save the file within inverted double quotes as "filename.h"
 
you can save it to any path as required.
 
Then in you cpp file, you can include this file as using include statement
 

Here is an example...
 

 

#include "headerfileName.h" //including the header file you created
 
int main() {
 
//code
 
return 0;
}
 
Best of Luck..! Smile | :)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 359
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 22 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100