Using build flags "-x c++" and Building Arduino Libraries

I am currently trying to use an Arduino open source library (a touch display one) and I am fairly certain that I am missing some arm-none-eabi-g++ compiler flags.
In the Arduino IDE, it works and uses the missing flags,"-w -x c++ -E -CC"

However, when I try to include these flags in platformio.ini, it does not recognize the language c++ after -x.
So inside the .json file I am left with simply
-w -x -E -CC
and the compiler says:
arm-none-eabi-g++: error: language -E not recognized

How do I get the compiler flag to recognize the -x c++ flag (along with the rest of them) if I can’t manually modify the .json file?

Thank you

Anybody else experiencing this problem? What can I do to set the language flag?

Why do you need that?

Those are the flags used in the Arduino compiler. Some libraries do not compile correctly - it has to do with the SPI communication and Adafruit graphics libraries. I’m not sure why, during g++ compilation you still have to use -x c++. But the exact same code will compile in the Arduino IDE and works properly, these are the only compiler flags that are missing.

Could you provide a simple project which doesn’t work with PIO?

This library does not compile correctly:

Please provide a project, not a library.