Arduino Forum

Products => Arduino CLI => Topic started by: ashutosh_pandey on Jun 15, 2020, 07:00 am

Title: How to get C++ file from Arduino Preprocessor?
Post by: ashutosh_pandey on Jun 15, 2020, 07:00 am
Hi,

I need the C++ output from the Arduino preprocessor https://github.com/arduino/arduino-preprocessor (https://github.com/arduino/arduino-preprocessor)

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.

Thanks
Title: Re: How to get C++ file from Arduino Preprocessor?
Post by: pert on Jun 15, 2020, 07:45 am
I know it's not answering your question, but arduino-cli compile --preprocess outputs the preprocessed sketch.

If you do a compilation in the beta build of the Arduino IDE (https://www.arduino.cc/en/Main/Software#beta) 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 (https://github.com/arduino/arduino-builder), 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.