Adding library header in uVision

For example, I want to include "EC_GPIO.h" and "EC_GPIO.c" in main.c

Method 1

Copy the "EC_GPIO.h" and "EC_GPIO.c" in the same project folder where main.c is located.

Then, Click the Source group > Add Existing Files to Group > Select "EC_GPIO.c"

Then, it should compile without errors.

Method 2 (recommend)

Include header file, located in a specific location

  • Example: all header files are located in Github directory under 'lib'

  • eg: C:\xxx\source\repos\GithubDesktop\EC-stm32f4\EC-STM32f411\Lib

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

In the Options for Target1, 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.

Create New Group

  1. Right-click the Project>Target1. Select Add Group

  2. Right-Click Project> New Group and **** Select Options for Group 'New Group'

You can rename the group such as "HAL" in Manage Project Items.

Add a header file to the New Group

  1. On Options for Group 'New Group' > C/C++ Tab> Include Paths> choose where the header files are located

Right-click the Project> New Group, and Add Existing Files to Group

Add "EC_GPIO.h" and "EC_GPIO.c" , and other necessary " *.h" and ".c" from the lib location.


Last updated