+12

How to make header files

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

2/9/2017 8:19:56 AM

shweta

26 Answers

New Answer

+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

+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.

+4

do not forget to protect the header from multiple inclusion ! #idndef _MY_HEADER #define _MY_HEADER // put your defines etc here ! #endif

+2

you can make header files in Dev C++.

+2

just create the header codes inside a file and rename the created file's extension format to .h

+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

+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.

+2

create file with extension .h

+1

create a new file in the project then while saving it change the extension from .cpp to .h

+1

that is #ifndef , but the sololearn app doesn't let me edit my post.

+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

+1

create a file with extension .h

+1

#include<>

0

be create specific file

0

create a file with the extension .h

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.

0

creat file to ,h is konw as header file

0

i don't understand what you say.i just learn it

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

0

I'm new here. Looking forward to write my first code. Need Heeeeelp