NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Make header file
July 17, 2011 by MetalSoftForScience |
Hi. I was just wondering how to make a header file to include in some of my projects. |
---|---|
July 17, 2011 by Ralphxyz |
You literally allready know. Here is how my OS X IDE (Xfile) did it for me:
This is from untitled.c you just include your header file. The contents of your header file is another discussion ;-) Ralph |
July 17, 2011 by Robotnik |
Here is an example. just make a file called file_name.h. Lets say it has a function in it called add...
then to include that file into your project you would include it in like this
|
July 17, 2011 by Robotnik |
oops, how embarrassing... I forgot a semicolon :/
|
July 18, 2011 by MetalSoftForScience |
I understand once I have the <something>.h file, how to include that in my code. I just don't understand how to make the file be a .h file. I tried renaming it but that changed it to <something.h>.c. Can somebody please help with how to actually make the ".h" file. |
July 18, 2011 by Ralphxyz |
MetalSoftForScience, what ever you used to rename your .c file to .h has a default setting to always append .c to any new file save. You have to look for an override of the default setting. You probable are using some sort of ide to make your file projects. You also might be able to use a text file editor to make your .h file and then use your ide to edit it. If you look at your settings there is a override. What OS are you on? Ralph |
July 18, 2011 by MetalSoftForScience |
I am using windows 7 professional. To rename it, I just renamed it. I tried opening it in notepad and would then save as <something>.h. It wouldn't work, just appendaged that ".c" anyway. |
July 18, 2011 by Ralphxyz |
Notepad will do ugly things don't even bother trying to use it. You can download NotePad++ it is a terrific text editor plus it gives you syntax highlighting. There is a Programmers NotePad in the Nerdkits download that is often used. It is already installed on your computer. Ralph |
July 18, 2011 by MetalSoftForScience |
So in Programmers NotePad, just save with the header file extension? |
July 19, 2011 by Ralphxyz |
Most likely, I most use my Mac mini only occasionally Windows and Programmers NotePad. I think you will really like Programmers NotePad. Of course there is also AVR Studio from Atmel but that gets complicated so I'd stick with Programmers NotePad or NotePad++ anything but Notepad. Ralph |
Please log in to post a reply.
Did you know that the printf format string "%.3f" will show three digits after the decimal point? Learn more...
|