Add existing file to a Project
Sometimes you need to add already existing files to your project, for example AUTOSAR MCAL drivers. If you want to add existing source file to your project, you have these alternatives to do that:
- Alternative 1
-
Import source files from the file system. The import procedure copies the source files into the project file system location.
- Alternative 2
-
Create a link to an existing file in the file system. In this case, the original file is not copied and remains at their location. The project holds just a link to it.
Import source file
The import source file is the right option in case that you want to copy an existing source file into your workspace. In that case, you either select
or in the Project Explorer window .In the import wizard select
and click to .-
Browse for the directory from where you want to import source files.
-
Select files to import.
-
Select destination folder within the project.
MyProject/src
in this case. -
Click the .
Once you finish the import wizard, all imported files appear in your project explorer view.
Link to an existing file
Linking existing file is beneficial in case you have to build source files, but you do not want to copy them into your workspace. In that case, you can create a link to them.
To create a link to file, please follow these steps:
-
Open import wizard by selecting the
or in the Project Explorer window . -
Browse for the directory from where you want to import source files.
-
Select files to import.
-
Select destination folder within the project.
MyProject/whetstone
in this case. -
Click the
-
Set
Create links in workspace
option. -
Set
Create link location relative to:
option. -
Select path variable which best fit your needs.
PROJECT_LOC
is the default. -
Click the
Once you finish the import wizard, all linked files appear in your project explorer view.
You can easily distinguish the imported and linked sources according to their icons.
Imported source file icon. |
|
Linked source file icon |
|
Linked folder icon. |