Use of a standard predefined C++ macros

first of all: I’ve just installed platformio yesterday so being an absolute newbie. Please be patient :slight_smile:
To keep track of source code location from installed/running programs as first action I always print the __FILE__ variable give me the location of the source. This works fine in plain Arduino programs, the whole path is printed. However with platformio all I get printeted is “main.cpp” not the whole path.

Standard Predefined Macros (The C Preprocessor) explains:
FILE This macro expands to the name of the current input file, in the form of a C string constant. This is the path by which the preprocessor opened the file, not the short name specified in ‘#include’ or as the input file name argument. For example, “/usr/local/include/myheader.h” is a possible expansion of this macro.”

What is wrong with my code:

printf("\n\nCompiled \nfrom: %s \n  on %s %s\n", __FILE__, __DATE__ , __TIME__);

I like to see the whole path printed as in plain Arduino.
Thank you

The macros have some underscores before and after the word.

So instead of




The underscores weren’t visible due to bad formatting in the original post (__X__ is the same as italics or bold), but they are there.

Meaning only the relativ path from src/? Can you give an example output?