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.

Compiler: #include search path ordering with multiple --include_path options

Expert 1226 points

Tool/software: TI C/C++ Compiler

What is the #include search path order for the TI ARM compiler (or the assembler and the linker, for that matter) when multiple --include_path (or -l) options are passed on the command line? ( --search_path for the linker.)

For example, take the following invocation:

ti-cgt-arm_16.9.4.LTS/bin/armcl --include_path="PathA" --include_path="PathB" file.c

Where file.c includes:

#include <file.def>

Some experimenting suggests that the options passed first have priority over the ones passed later.  That is, in the previous invocation PathA will first be searched for file.def, and only if such a file is not present, will PathB be searched.  (In other words, if files named file.def are present in both PathA and PathB, it is the one in PathA that will be used.)

Is this reliably the case?

Is this behavior guaranteed for future releases of the TI ARM tools?

Sections 2.5.2 and 2.5.2.1 of spnu151q do not specify this detail.  (Nor does section 4.5.1, 8.4.11, or 8.4.18 of spnu118t.)

--thx

(Note, I am aware that when using the "" version, e.g. #include "file.def", first priority in the search path will be given to files in the same directory as the file which has the #include directive.)

  • For reference by others who read this thread, the first ARM compiler manual section you mention is titled The Search Path for #include Files.  This is the most precise statement of the order of search paths used.  You are correct to say that it does not specify the order among the directories given with the option --include_path.  

    1138 said:
    Some experimenting suggests that the options passed first have priority over the ones passed later.

    This is correct.  It has always worked this way, and will continue to always work this way.

    Thanks and regards,

    -George

  • Excellent, good to know, thank you.

    Is this ordering also true and guaranteed for the TI ARM assembler's --include_path option and the linker's --search_path option?

    --thx

  • 1138 said:
    Is this ordering also true and guaranteed for the TI ARM assembler's --include_path option and the linker's --search_path option?

    Yes.  -George