How to get C++ file from Arduino Preprocessor?


I need the C++ output from the Arduino preprocessor GitHub - arduino/arduino-preprocessor: Parses an Arduino Sketch and converts it into valid C++ source code

I know it's possible to get the C++ file by enabling verbose output during compile and then clicking verify and finding the temp file, but I wanted to know if there's a way to get the output of the preprocessor.

The GitHub page doesn't have any instructions on how to install the preprocessor or use it seperately.

I am asking here because according to another thread, the Arduino Preprocessor is a part of Arduino CLI.


I know it's not answering your question, but [color=limegreen]arduino-cli compile --preprocess[/color] outputs the preprocessed sketch.

If you do a compilation in the beta build of the Arduino IDE with verbose output enabled, you can see the commands it generates to use the arduino-preprocessor executable (which is bundled with the Arduino IDE under tools-builder/arduino-preprocessor, but only appears to be used by the beta IDE).

My understanding was that arduino-preprocessor is only used by the beta build of the Arduino IDE and Arduino CLI (along with the production and nightly releases of the Arduino IDE) are using the previous preprocessing code originally written for the arduino-builder tool, which has since been moved to Arduino CLI (arduino-builder is still used by the Arduino IDE, but it's become mostly just a wrapper for Arduino CLI). However, I really don't have much of an understanding of the internals of Arduino CLI, so I could be very wrong about this.