When creating projects with linked folders (whether manually or using one of C/C++test available project importers for supported IDEs), the default settings have linked folders specified by absolute path. This may be fine a single desktop user, but it could present a problem if the project is shared by multiple developers who have source code checked out in different root locations. In this case, it is safer to create linked folders using a variable, which you then set to your preference.

To add a linked folder to an existing project:

  1. Choose New> Other> General> Folder.
  2. Select the project to which you want to add a folder.
  3. Click the Advanced>> button.
  4. Enable the Link to alternate location (Lindek Folder) option.
  5. Provide the absolute path to the folder you want to add or click Browse to navigate to the folder.

If you wanted to add a folder with a variable for the root location:

  1. Click Variables in the New Folder dialog.
  2. Define a variable you’d like to use for the root location of the folder.
  3. Click New and specify the variable name, and either type in the folder location, or click the Folder button to use the file browser.



  4. Do one of the following:
  5. Click Finish. Notice that the linked folder with the specified name was added to the project.

When you check the Properties> Resource on the new folder, the folder location is defined in terms of the root variable (DEMO_DIR in this case), and the resolved path is provided as well:



The directory variables that are specified in the linked folder dialog can be accessed via Window> Preferences> General> Workspace> Linked Resources. They should be set up for each user, and their values are stored in the user’s Eclipse workspace. These variables do not appear in the user’s shell environment on the workstation—and they should not be set there. If you ever need to recreate the workspace, it is easy to re-define these variables when the projects using them are imported into the new workspace.

Note that multiple variables can be used when setting up linked folders to bundle together directories that are in multiple relative locations. Remember to update your preferences with the variable values matching your directory setup.