Linking folders to a project

From Texas Instruments Wiki
Jump to: navigation, search

Background

In CCS you can have files that are physically part of your project and files that are linked to your project (i.e. referenced).  When adding files to your project if you select "Add file" it copies the file into your project and when you select "Link File" it leaves the file where it is and creates a reference.

It is very important that all files be part of your project so that the indexer and search functions can work properly.  One common problem that people run into is that they have whole directories of files outside of their project and linking each file individually just takes too long.  This is very common when adding a pre-built library to your project as there will be a directory of header files that go with it.

One thing that you can do to make things a lot easier is to link a folder to your project.

How to Link a Folder

The procedure described below works with all version of CCSv5, but starting with CCS 5.1.0, the procedure is even further simplified. You can link a folder to a project simply by selecting it in Windows Explorer and dragging and dropping it into the project in the Project Explorer view. At that point, CCS will ask if you want to "copy" or "link" to that folder. If you select "Link to files and folders", it will create a reference to that folder.

An alternate method is the following:

Right click on your Project and select New -> Folder

NewFolder.png

Click on the Advanced Button (The screen capture below is from CCSv5.0.0, in CCSv4.x there is a single checkbox to "Link to folder in the file system")

NewFolderAdvanced.png

In CCSv5 Select "Link to alternate location (Linked Folder)" in CCSv4 select "Link to folder in the file system"

Browse to the folder you want to Link to your project or if you want to make your project portable you can add the path using a variable by clicking on the Variables button.

When you are done you should see the folder in your project.

LinkedFolder.png


Building

Any source files inside this folder will now be built when you build your project.  If there are header files inside of it you will have to add it to the include paths in the build options.  However as it is now in your project you can click on the workspace button when adding the include path and it will add the file using the workspace macro so that you don't have to worry about absolute paths.

It will look something like this:

LinkedFolderMacroIncludePath.png

Search

The search will now include the files in the linked folder

SearchOutsideFolder.png