AnsweredAssumed Answered

Controlling "-cwd include" option in Eclipse

Question asked by avm on Jan 20, 2016
Latest reply on Jan 20, 2016 by Fiona Kuang

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:

  • #include "somefile.h" should search my user and user recursive folders first, then the system and system recursive folders.
  • #include <somefile.h> should only search the system and system recursive folders and not look in any of the user include paths.
  • I don't care about the current folder: all my folders are in the various include search paths. Just using user/system or system paths is enough for me.

 

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?

Outcomes