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.
Hi
Im trying to "link" to a sub-directory from another project (Prj_B) to my current project (Prj_A). I would like to than be able to #include the parent header file from Prj_B_SubDir in Prj_A and use the functions from Prj_B_SubDir in Prj_A.
I say "link" but Im not sure of the proper terminology in the context of CCS, basically I have tried adding it to Prj_A as I would any other include directory, adding a resource path variable, using that to add it to the C2000 compiler include search path and also the linker directory search path.
Doing this however adds the Prj_B_SubDir to the includes list as hoped, but with an icon of a group of purple folders (see image), rather than the normal single yellow/brown directory icon. Also, Prj_A builds OK with a #include "Prj_B_SubDir" but the actual code/objects from Prj_B_SubDir are not being added to the project, as they does not show up in the map file.
What is the proper way for me to use the code from a folder within another project?
Looking at the device support include directories, I wonder if my Prj_B needs to have a certain directory structure?
Thanks
P.S. My reason for wanting to do this is that I dont want to have two copies of Prj_B_SubDir as I am developing it in tandem so I want changes to Prj_B to be reflected in Prj_A, if there is a better way of doing this let me know :)
P.P.S. I did look at http://processors.wiki.ti.com/index.php/Include_paths_and_options but I am not understanding correctly what it is I want to do in CCS terminology so am not sure what pieces of this information to use...
I don't know the meaning of the icon colours, though think your are doing right.
However, if I were you I would not add include folder to search path. In our company we developed a culture of having source tree. Then you may use relative path specs to reference header. For instance if you have projA/include/pa.h and projB/include/pb.h and working somewhere in projA/bla/src.c. Then you may
#include "../include/pa.h"
#include "../../projB/include/pb.h"
This way you eliminate the need for your collaborators to setup include path same to yours. And finally if you have portion of code suitable for several projects, why don't you create kind of 'common' folder and place that code there?
There are a few different pieces to what you are asking and I hope the following references/answers help you out.
First, if you want to add the source files from Prj_B to Prj_A, then you can either link files and/or folders from Prj_B to Prj_A. See http://processors.wiki.ti.com/index.php/Projects_and_Build_Handbook_for_CCS#Adding_or_linking_source_files_and_folders_to_project
If you only want to reference the header files from Prj_B and not use any of the source files, then you can simply add the path to the header file in the compiler include options for Prj_A. It appears that you already tried that but I think you may have tripped up here:
Toby Mole said:basically I have tried adding it to Prj_A as I would any other include directory, adding a resource path variable, using that to add it to the C2000 compiler include search path and also the linker directory search path.
If you are using a variable, it needs to be a Build Variable and not a Linked Resource path variable - the difference between the two is explained here:
http://processors.wiki.ti.com/index.php/Portable_Projects#Portable_Projects_in_CCSv5
At first, I would recommend starting simple and get it working by specifying absolute paths in the compiler include search path option to make sure it is finding the header file. Then you can make the project more portable by creating a build variable and changing the include search path to use the build variable instead of the absolute path, as per the above wiki link.