Running "test" from my sketch always returns 0. On the other hand, if I define the body of the test function in test.h instead of test.cpp the above example works. I'm a bit confused. Thanks again!
The .cpp file is not merged on source level with your sketch, it compiles to an .o file and get linked. It can only relate to things included.
The .h file on the other hand is merged with the source file (to be able to reference the .o file) so #defines will be visible for the preprocessor and will be taken into account when compiling.
AFAIK the solution to your problem is to define a "myconstants.h" file that is included both
in your sketch and in the library.