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.
Tool/software: Code Composer Studio
I'm hacking at a copy of the power_measurement example project in my workspace under CCS v6.2.00050.
I'm have bma222drv.h "linked" into my project. Examination of Properties for the file show the link to be correct.
I get a red "X" (with rollover showing "#1965 cannot open source file "bma222drv.h" from CCS.
I have seen others posts which seem to say that I need to specify the oob project location for including files. I don't want to do that, since I don't want the compiler rummaging around there looking for things I may have forgotten.
Since CCS and the compiler have clearly correctly resolved my link to bma222drv.h in the oob project (see screenshots) and file is there (I can clink on the link and it opens), what's the problem?
Compiler can't find linked header file - Code Composer Studio forum - Code Composer Studio™︎ - TI E2E...
Ralph,
Compilers do not search below the include paths specified. This is standard behavior for compilers. I suppose someone could implement one that searched sub-directories but that would lead to many cases of inconsistent results and have significant performance issues.
When you add a "linked" file it just adds an entry in one of the project files that specifies that the file is linked, there won't be any file in your project directory. Part of what confuses people is that it seems different for C files and .H files. That is because .C files are input files. The IDE gathers up the input files and passes them to the compiler. The header files do not get passed to the compiler, the compiler looks for them during compilation when it encounters a #include statement in an input file. When it looks for them it uses the information in the #include statement ("" or <> and any path info) and the include search path.
If you have a set of input files that are shared across projects you could put them in a common folder and then search the search path of each project to point to that.
The other thing to do is manage the search path order. The compiler will use the first file it finds on the search path. For example if you have a file.h in a /inc folder in your project and another file.h in a common header file folder just make sure the path to your projects /inc folder is listed above the common one and then the compiler will use the one in the project and only if it can't find one there will it use the one from the common folder.
One thing that would make it easier is if when linking a .h file the path to that file got automatically added to the search path. I can file a request for that. I am not sure if we have the ability to change it or not but it is worth checking.
Regards,
John