Files in MPLAB® X IDE Projects
This section discusses methods used to manipulate files in MPLAB® X Integrated Development Environment (IDE) projects.
Creating a New Source File
MPLAB® X Integrated Development Environment (IDE) provides several file templates which can be used as a starting point to create new source code files in your project. On this page, we will show you how to create a new main.c file as well as a new header file in an empty PIC® MCU project.
Projects Window View
This video provides a short review of the MPLAB X IDE's Projects window/tab view:
- Identify the difference between the Projects window and Files window
- Identify where various project files are located in the Projects window
Creating a New Source Code File
This video will show you how to add a new main.c file to your project using a provided file template in MPLAB X IDE:
- Open the New File wizard
- Select an appropriate main.c file template
- Perform a clean build
Creating a New Header File
This video will show you how to add a new header source code file to your project using a provided file template in MPLAB X IDE:
- Open the New File wizard
- Select an appropriate C/C++ header file template
- Add content to the header file
- Modify main.c to #include the new header file
- Perform a clean build
Adding An Existing Source Code File
This video outlines a simple method for adding existing source code files to a project.
- Copy files into the project folder using a file browser
- Add files to the project in MPLAB X IDE
Deleting files from a project
This video outlines methods for permanently deleting files from projects:
- Deleting files from the Files tab
- Right click on the filename
- Select Delete
- In the confirmation window click Yes
- Next, remove the file reference from your project
- Right click on the filename in the project window
- Select Remove from Project
- Deleting files using your file manager
- Right click on the filename in File Manager
- Select Move to Trash
- Next, remove the file reference from your project
- Right click on the filename in the project window
- Select Remove from Project
File Renaming
- Open the Project or Files tab
- Right Click on the filename
- Select Rename
- Enter the new name
- Hit Ok
- Your done!
Removing Files From a Project Build
This video outlines two methods for removing files from a project build:
- Exclude file from the current project configuration
- Right Click on file name in the project window
- Select Exclude File from Current Configuration
Or
- Remove file from the project
- Right click on file name in the project window
- Select Remove from Project
Downloads for Video Examples
- MPLAB Development Ecosystem Toolchain (Optional)
- Example Project File
- PIC18F16Q41 Curiosity Nano Evaluation Kit
- MPLAB® X IDE
- XC8