cannot include <whatever.h> in my library

This is my first attempt at writiing a library.

in the library folder, I created a new folder named C:\Program Files (x86)\Arduino\libraries\MyLib.
in MyLib, I have two files : MyLib.h and MyLib.cpp
MyLib.h starts with the following lines:

#include <SPI.h>
#include <SdFat.h>

My test file stars with:#include <MyLib.h>
This does not compile. I get this error message:

Arduino : 1.6.1 (Windows 7), Carte : "Arduino Uno"
In file included from test.ino:8:0:
C:\Program Files (x86)\Arduino\libraries\MyLib/MyLib.h:10:17: fatal error: SPI.h: No such file or directory
 #include <SPI.h>

compilation terminated.

I can do these includes in test.ino. Why not in my library? What is going wrong?

It has to do with the way the IDE puts together the code. It only looks at the .ino file to figure out where to get libraries from. You have to have an #include for every file you want included in the .ino even if it isn't used in the .ino.

If you want it to work differently then you need a different IDE. It's messed up I know, but it's not my IDE to fix. That's just what we have to work with.

Works 8) !! Thanks !