Keil Logo

µVISION: ADDING HEADER FILES TO A PROJECT


Information in this article applies to:

  • µVision Version 2.07 and later

QUESTION

I have created a HEADER FILES group under my TARGET folder. Then I try to add .H files to the group. However, the .H file extension is not listed as an option. What is the proper way to add header files to the project structure in µVision?

ANSWER

Add a header file to the Project window

µVision does not require you to add header files in the project structure, but you may want to add them so you can easily locate and open them for reference. Note that you can right-click on an #include  filename in your source code to open that header file.

  1. Right-click the Project group you want to add the file to and select Add Files to Group from the pop-up menu.
  2. Select All Files (*.*) from the Files of Type list.
  3. Select the header file you wish to add to the project.
  4. When prompted to select the file type, choose Text Document File.

Add a header file to a source file

In µVision5, towards the top of the source file, right-click and select Insert '#include file' and then select the file.

Some header files get called by other header files, e.g., for projects using CMSIS-compliant code, include the [device_name].h file includes many other helper header files.

If header files don't display in the project window

After successfully building a project, the header file names appear under each source file. Expand each source file to see the header file names.  Double-click the header file name to display the header file.

If the header file names do not appear, the Show Include File Dependencies option in the Project window may be disabled.

To enable the option right click on a item in the Project Window and enable Show Include File Dependencies. After that, µVision's Find-in-Files feature will also consider the include files of your project when you search at the project level.

Specify an 'Include Path' for your project's header files

In the Options for Target, C/C++ tab of your project, the Include Paths box allows you to specify the one or more additional folders to search for header files. For more information, see the Include Paths section of the C/C++ on-line help page.

Last Reviewed: Monday, December 7, 2020


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.