+ 11

How to make header files

if we want to make a header file...how?

9th Feb 2017, 8:19 AM
shweta
shweta - avatar
24 Réponses
+ 12
a header file has the extension .h Saving a file with this extension will make the IDE to interpret it as a header file
9th Feb 2017, 7:10 PM
Challenge me
Challenge me - avatar
+ 5
Header files can be created by making a program with functions and then saving it with ".h" instead of ".cpp" then go to the folder where program was saved and copy your saved file to folder where other include files are kept. To use a function in that header file include that header file and just call the function like you call anything else {like: exit(); or strlen();} caution: do not define a main function in header file or it will show show error while execution.
13th Feb 2017, 2:31 PM
Nik.
Nik. - avatar
+ 4
do not forget to protect the header from multiple inclusion ! #idndef _MY_HEADER #define _MY_HEADER // put your defines etc here ! #endif
10th Feb 2017, 6:53 PM
Edwin Martens
Edwin Martens - avatar
+ 2
you can make header files in Dev C++.
9th Feb 2017, 11:33 AM
Muhammad Sameem
Muhammad Sameem - avatar
+ 2
just create the header codes inside a file and rename the created file's extension format to .h
9th Feb 2017, 4:11 PM
Ms Arnold
Ms Arnold - avatar
+ 2
you have to create a new file with the extention. h and add it to the project and then you can include it to your code
10th Feb 2017, 8:48 AM
mohammad al masri
+ 2
You can create can also create a notepad or text file and save it as a .h file extension that will convert into a header file.
14th Feb 2017, 12:43 AM
David Oats
David Oats - avatar
+ 2
create file with extension .h
20th Feb 2017, 5:08 AM
Геннадий Грудяев
Геннадий Грудяев - avatar
+ 1
create a new file in the project then while saving it change the extension from .cpp to .h
9th Feb 2017, 11:12 PM
Oumayma MOULOUDI
Oumayma MOULOUDI - avatar
+ 1
that is #ifndef , but the sololearn app doesn't let me edit my post.
10th Feb 2017, 6:58 PM
Edwin Martens
Edwin Martens - avatar
+ 1
save your code in form of a class and its methods. save it with a .h extension. and dont put main function in the file. to use it include in your file
11th Feb 2017, 10:20 AM
Tejas Parmar
Tejas Parmar - avatar
+ 1
create a file with extension .h
17th Feb 2017, 3:49 AM
Raja Chouhan
Raja Chouhan - avatar
+ 1
#include<>
20th Feb 2017, 4:52 PM
Shivam Gumber
0
be create specific file
12th Feb 2017, 10:50 AM
Aman Mehta
0
create a file with the extension .h
12th Feb 2017, 1:48 PM
Robin Deckert
Robin Deckert - avatar
0
make sure that you save your header files with the extension .h and it has no main function in it. it must contain only functions.
16th Feb 2017, 1:19 PM
Monish Krishnan
Monish Krishnan - avatar
0
creat file to ,h is konw as header file
18th Feb 2017, 4:35 PM
gkhh
0
i don't understand what you say.i just learn it
20th Feb 2017, 7:45 AM
Edward
0
As everyone told that header file can be created by saving it with .h extension but to access it you need to use #include"yourHeaderFileName.h" .If you use #include<yourHeaderFileName.h> the preprocessor will look in standard file location for this header file but will not find it is not a part of standard library files.Hope You Understand
20th Feb 2017, 2:35 PM
Mohit Sahu
Mohit Sahu - avatar
0
I'm new here. Looking forward to write my first code. Need Heeeeelp
20th Feb 2017, 7:22 PM
ABDELKADIR AMICHE
ABDELKADIR AMICHE - avatar