Thanks to everybody, now I get a better solution. It is changing the build path to our working directory, and then we can use relative path!
Here are the deatiled steps:
- Click IDE's
File-Preferencesand find where it storagespreferences.txt. Mine is atC:\Users\Administrator\AppData\Roaming\Arduino15\preferences.txt - In the txt file add this line:
build.path=D:\MyProject\ArduinoBuild. This means let Arduino put the temp files in this directory, such as the.hwaiting to compile. - Because the
.hArduino automatically generated from our.inois inArduinoBuilddirectory, you can now use#include "./../Share/SomeShare.h"in order to include theD:\MyProject\Share\SomeShare.h
Here is the same question asked in another stackexchange board: HereHere