I've seen this problem a few times, but haven't seen a solution yet. I'm having this issue and am troubleshooting it to find a solution. Here's what I've found so far...
"C:\\progra~2\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\progra~2\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\progra~2\\Arduino\\hardware\\arduino\\avr\\variants\\mega" "C:\\Users\\Nathan\\AppData\\Local\\Temp\\arduino_build_469035\\sketch\\Blink2.ino.cpp" -o nul
the problem in the above codebox is the "nul" at the end (i.e. after the "-o"). The "-o" flag needs to be followed by a path to an output file, but instead is followed by 'nul'. When I copy/pasted the above command from the Arduino IDE terminal and then manually editied it by replacing "nul" with a file path, it outputted a file (attached to this post - "Blink2.ino.ppp" ).
This file looks like a c++ source file and is heavily documented with boilerplate comments. If I can somehow compile this outputted c++ source file and send the compiled version to the arduino, I think it would work. I'll update this thread as a figure out more.
So it looks like my initial hypothesis was wrong, pert's verbose log also has "-o nul" in it. I guess the reason for the "-o nul" is to keep the console from displaying the output. If the -o is removed from the command, it spams the console with the output file.