This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCSv6.1.1: CCS changed include path after importing project (with copy) into a new workspace.

Guru 19935 points
Other Parts Discussed in Thread: CONTROLSUITE

Hello,

I had imported (with copy) a project into a new workspace yesterday.  Today, while comparing the .cproject files from the original project and the one that was copied, I noticed a new string macro named {ORIGINAL_PROJECT_ROOT} had been created in the copied project's .cproject file and the string macro value is equal to the original project directory..  Also, the original macro, {PROJECT_ROOT}, was replaced by {ORIGINAL_PROJECT_ROOT} in all the include paths.

Why isn't CCS using the copied project's root directory as a basis for its include paths?

Thanks,

Stephen

  • stevenh said:
    Why isn't CCS using the copied project's root directory as a basis for its include paths?

    When a project is imported using the "Copy to workspace" checkbox, only the files within the original project folder will be copied to the workspace. This includes the project files and any source files that are present within the project folder. However, any linked resources that are part of the original project will not be copied to the workspace, and will remain at their original locations. If that is the case, then include paths will need to reference files relative to the original project, hence will need to use ORIGINAL_PROJECT_ROOT.

  • Hello AartiG,

    The include files were not linked resources and they were copied to the new workspace. However, CCS still created a new string macro named ORIGINAL_PROJECT_ROOT and used it for all the include paths. 

    Stephen

  • Hello AartiG,

    The non-linked header files were copied to the workspace and there aren't any linked files in the previous previous project, so why is CCS generating a new path variable (that contains the path to the previous project) for the include files?

    Stephen

  • stevenh said:
    The non-linked header files were copied to the workspace and there aren't any linked files in the previous previous project, so why is CCS generating a new path variable (that contains the path to the previous project) for the include files?

    How was the include path set in the original project? Was it relative to PROJECT_ROOT? If so, that would be modified to ORIGINAL_PROJECT_ROOT when the project is imported and copied to another workspace to support the use-case where the include files may still reside/and need to be referenced from a location relative to the original project.

    If you wish to specify the path to always be relative to the *current* project directory, you can use the variable ProjDirPath. Let us know if that helps.

  • "How was the include path set in the original project? Was it relative to PROJECT_ROOT? If so, that would be modified to ORIGINAL_PROJECT_ROOT when the project is imported and copied to another workspace to support the use-case where the include files may still reside/and need to be referenced from a location relative to the original project."

    Is that the way Eclipse works?  The include files are copied to the workspace, so why would someone want to reference the old project directory.  It really doesn't make sense.  Actually, if I looked in the cproject file, I would have not known that the include path was changed.  This can really cause a lot of confusion.  I would think that CCS would give a user the option of changing the include path and not just change it behind the scene.  Has anyone else complained about this?\\

    "If you wish to specify the path to always be relative to the *current* project directory, you can use the variable ProjDirPath. Let us know if that helps."

    How do I change the ProjDirPath variable? 

     

  • stevenh said:
    The include files are copied to the workspace, so why would someone want to reference the old project directory.

    The include files will be copied to workspace only if they reside directly in the project directory or in a subdirectory within the project directory. Many projects are structured such that the include files reside in a common folder either at the same level as the project folder or even at higher level directories. This way several projects can use/reference the same set of common include files. Many TI software packages such as TivaWare, ControlSuite are set up this way.

    In such cases, the compiler include paths are usually set relative to variables (which are typically the root folder of the software package) to keep the project portable. When importing such projects, even if "Copy project to workspace" is enabled, the includes files/folders will not be copied to workspace as they are not directly within the project directory. So the include paths will still need to reference them relative to the original project folder.

    The correct and portable way to set up include paths will be dependent on the project layout and how it is intended to be used.

    What were the include paths set to in your original project?

  • The include path in the original project was set relative to PROJECT_ROOT.

    I still think CCS should give user the option to change or not change the include path.  Changing it in the background causes a lot of confusion and wasted time.

  • stevenh said:
    The include path in the original project was set relative to PROJECT_ROOT.

    If you change that to be relative to ${ProjDirPath} you should be ok.

  • Thanks.

    I don't see it defined in Resources->Linked Resources->Path Variables.  Where is it defined?

  • It is a build variable. Go to Project Properties->Build->Variables tab, and check the box for "Show system variables".