local header name same as library name

Hi All, I am sorry if this is a basic question but I cannot figure out how to use a local sketch that has a "test.h" header name which is the same as a library in my arduino /library/test library. Note, "test" is not a real name. I am using this name just to explain the problem.

Right now I am getting the error: "In file included from C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\test\test.cpp:37:"

I am not using the "test" library, I am just using a "test.h" header that unfortunately shares the same name as the library.

In my main code I have added this line: #include "test.h" but this line brings the library file not the local sketch.

thank you in advance for your help.

Rename the file.

The IDE does some behind the scenes work in attempt to make things easier. One of those things is to try to "guess" which libraries you are using. It does that by scanning your sketch code looking for #include of header files. If it finds a library that has that header in it, it assumes that you want to use that library. It plays games with the include path which determines which order directories are looked at to find the include files.

My guess is that the IDE finds your test.h header file in some library, then attempts to build that library but because of the header name collision, you are not getting what you want and things are getting confused.

This is actually a bug in the IDE parser that looks for header files in that a local .h should take precedence over a library that uses that same header name but apparently they didn't take that into account.

Getting something this fixed in the IDE is often difficult as it can be difficult to get the Arduino teams attention even if a bug report is filled out. For now, I go with david's suggestion and re-name your header.

I'd also go and fill out a bug report for this so that it can be fixed. Right now is probably a good time to report this bug as there has recently been some updates to that parsing code and so they will probably be more receptive to fixing this.

--- bill