Targeting Kinetis using CodeWarrior 10.5, I'm having trouble with the system include paths. If I try to #include <somefile.h> using angle brackets, I would expect it to only search the include paths in the system and system recursive path lists. However, if somefile.h happens to exist in the current directory, it always finds that local file. I wouldn't be too surprised for that to happen if the #include statement uses quotes, but I don't think it should do it if using angle brackets.
Looking at the project properties, in the "All options" box which shows the command line options, I see that the "-cwd include" option is selected. According to the documents, this says to search the directory of the referencing file first. I highly suspect that this is my problem. I think I need to use the "-cwd explicit" option to get the behavior I want which is:
Looking through all of the project configuration options, I don't see anywhere that the "-cwd include" can be controlled. It looks like it might be hard-coded somehow?
How do I change the project options so that it uses "-cwd explicit"? Or, how do I get it to not look in the current directory when using a #include with angle brackets?
Solved! Go to Solution.
Hello Avm
Are you using GCC compiler? It works in a different manner for searching head file.
It will look for headers requested with #include <
file>
in:
-Idir1 -Idir2 ...
/usr/local/include
libdir/gcc/<target>/<version>/include
/usr/<target>/include
/usr/include
All the directories named by -I are searched. So please check how you add the directories for this option in your project:
For details, you may review:
https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art026
Best Regards
Fiona Kuang
Technical Information & Commercial Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Avm
Are you using GCC compiler? It works in a different manner for searching head file.
It will look for headers requested with #include <
file>
in:
-Idir1 -Idir2 ...
/usr/local/include
libdir/gcc/<target>/<version>/include
/usr/<target>/include
/usr/include
All the directories named by -I are searched. So please check how you add the directories for this option in your project:
For details, you may review:
https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art026
Best Regards
Fiona Kuang
Technical Information & Commercial Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------