Keil Logo

Add Source Files to Project

You can add files in several ways to a project. The most common way is to click on a file group in the window Project and use the context menu Add New Item to Group or Add Existing Files to Group.

add files menu

Add New Item to Group

Using the menu or toolbar

New File Button Create a source file with the menu File - New. This opens an empty file in the editor window. Save the file (menu File - Save As) to make use of the syntax coloring feature.

Using the context menu in the Project Window

The option Add New Item to Group opens a dialog that allows you to add a new source file.

add new item

Type
  • C File (.c) - create an empty C source file.
  • C++ File (.cpp) - create an empty C++ source file.
  • Asm File (.s) - create an empty assembler source file.
  • Header File (.h) - create an empty header file.
  • Text File (.txt) - create an empty text file. Text files are not included into the target build process.
  • Image File (.*) - not applicable for C51, C251, and C166 toolchains.
  • User Code Template - create a source file containing function templates for the respective Software Component. Click on the Component to add the user code.
Name
Enter or change the file name.
Location
Shows the folder where the new item will be created.

Add Existing Files

Using the context menu in the Project window:

  • The option Add Existing Files to Group or Add Files to Group opens a standard file dialog that allows you to add one or more files.

Using the dialog Project - Manage - Project Items... - Project Items:

  • Select a File Group and click Add Files. This opens a standard file dialog that allows you to add one or more files.

Note

Syntax coloring is controlled by:

  • The option Use syntax coloring in the dialog Edit - Configuration - Editor.
  • The definitions in the dialog Edit - Configuration - Colors & Fonts.
  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.