Change ARDUINO IDE version variable

Hey,

//--------//
my setup:
latest VSCode 1.29.1 with latest PlatformIO
Windows 7
Arduino Mega 2560
//--------//

Yesterday, I ported my Arduino projects from the official Arduino IDE to PlatformIO. It all works well except of a few #include errors. The problems appear because all the affected libraries include a check of ARDUINO IDE version similar to this (in this case it checks if the Arduino IDE version is >= 1.00):

#if ARDUINO >= 100
#include "Arduino.h"
#include "Print.h"
#else
#include "WProgram.h"
#endif

When I compile my code and include these libraries, ARDUINO in my setup apparently is < 100 and PlatformIO tries to include the file WProgram, which doesn’t exist in my setup. Arduino.h and Print.h however exist. Thus, the #include problems could be fixed if I could set the constant ARDUINO to a value > 100.
Is there any way I “fake”/change this constant?

Thanks,
Dev

Change your LDF mode to chain+ or deep+, that should evaluate the macro correctly. Library Dependency Finder (LDF) — PlatformIO latest documentation

Thanks for the quick reply. Changing LDF to chain+ or deep+ didn’t solve the problem, however. My platformio.ini is as follows (with deep+ respectively):

;...

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
monitor_speed = 57600
lib_ldf_mode = chain+

Can you upload your project for reproduction?

This is my project (I replaced the source code with the Blink example). Is it allowed to post a Hyperlink to my box drive folder? If not, I can upload it in a different place as well.

my project

Your project compiles out of the box when using Linux and the latest platformio via the commandline…

$ pio run
Processing megaatmega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz 8KB RAM (248KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain+) COMPATIBILITY(soft)
Collected 28 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Rotary> (/home/max/Downloads/upload/lib/Rotary)
|-- <SPI> 1.0 (/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI)
|-- <HX8347D_kbv-master> (/home/max/Downloads/upload/lib/HX8347D_kbv-master)
|   |-- <Adafruit GFX Library> 1.3.2 (/home/max/Downloads/upload/lib/Adafruit_GFX_Library)
|   |   |-- <SPI> 1.0 (/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI)
|-- <Adafruit GFX Library> 1.3.2 (/home/max/Downloads/upload/lib/Adafruit_GFX_Library)
|   |-- <SPI> 1.0 (/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI)
avr-g++ -o .pioenvs/megaatmega2560/src/main.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib/HX8347D_kbv-master -Ilib/Adafruit_GFX_Library -I/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src -Ilib/Rotary -Isrc -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega src/main.cpp
avr-g++ -o .pioenvs/megaatmega2560/lib379/Rotary/Rotary.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib/Rotary -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega lib/Rotary/Rotary.cpp
avr-g++ -o .pioenvs/megaatmega2560/libe1a/SPI/SPI.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src/SPI.cpp
avr-g++ -o .pioenvs/megaatmega2560/libd7b/Adafruit_GFX_Library/Adafruit_GFX.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib/Adafruit_GFX_Library -I/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega lib/Adafruit_GFX_Library/Adafruit_GFX.cpp
avr-gcc-ar rc .pioenvs/megaatmega2560/lib379/libRotary.a .pioenvs/megaatmega2560/lib379/Rotary/Rotary.cpp.o
avr-gcc-ranlib .pioenvs/megaatmega2560/lib379/libRotary.a
avr-g++ -o .pioenvs/megaatmega2560/libd7b/Adafruit_GFX_Library/Adafruit_SPITFT.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib/Adafruit_GFX_Library -I/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega lib/Adafruit_GFX_Library/Adafruit_SPITFT.cpp
avr-gcc-ar rc .pioenvs/megaatmega2560/libe1a/libSPI.a .pioenvs/megaatmega2560/libe1a/SPI/SPI.cpp.o
avr-gcc-ranlib .pioenvs/megaatmega2560/libe1a/libSPI.a
avr-gcc -o .pioenvs/megaatmega2560/libd7b/Adafruit_GFX_Library/glcdfont.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib/Adafruit_GFX_Library -I/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega lib/Adafruit_GFX_Library/glcdfont.c
avr-g++ -o .pioenvs/megaatmega2560/lib3cd/HX8347D_kbv-master/HX8347D_kbv.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -Ilib/HX8347D_kbv-master -Ilib/Adafruit_GFX_Library -I/home/max/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega lib/HX8347D_kbv-master/HX8347D_kbv.cpp
lib/HX8347D_kbv-master/HX8347D_kbv.cpp: In member function 'void HX8347D_kbv::vertScroll(int16_t, int16_t, int16_t)':
lib/HX8347D_kbv-master/HX8347D_kbv.cpp:343:13: warning: unused variable 'bfa' [-Wunused-variable]
int16_t bfa = HEIGHT - top - scrollines;  // bottom fixed area
^
lib/HX8347D_kbv-master/HX8347D_kbv.cpp: In member function 'HX8347D_kbv::readReg(unsigned int)':
lib/HX8347D_kbv-master/HX8347D_kbv.cpp:191:15: warning: 'h' is used uninitialized in this function [-Wuninitialized]
return (h << 8) | l;
^
avr-gcc-ar rc .pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
avr-gcc-ranlib .pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
avr-gcc-ar rc .pioenvs/megaatmega2560/libd7b/libAdafruit_GFX_Library.a .pioenvs/megaatmega2560/libd7b/Adafruit_GFX_Library/Adafruit_GFX.cpp.o .pioenvs/megaatmega2560/libd7b/Adafruit_GFX_Library/Adafruit_SPITFT.cpp.o .pioenvs/megaatmega2560/libd7b/Adafruit_GFX_Library/glcdfont.c.o
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/CDC.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/CDC.cpp
avr-gcc-ranlib .pioenvs/megaatmega2560/libd7b/libAdafruit_GFX_Library.a
avr-gcc-ar rc .pioenvs/megaatmega2560/lib3cd/libHX8347D_kbv-master.a .pioenvs/megaatmega2560/lib3cd/HX8347D_kbv-master/HX8347D_kbv.cpp.o
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial.cpp
avr-gcc-ranlib .pioenvs/megaatmega2560/lib3cd/libHX8347D_kbv-master.a
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial0.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial0.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial1.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial1.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial2.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial2.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial3.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/HardwareSerial3.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/IPAddress.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/IPAddress.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/PluggableUSB.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/PluggableUSB.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/Print.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/Print.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/Stream.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/Stream.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/Tone.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/Tone.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/USBCore.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/USBCore.cpp
avr-gcc -o .pioenvs/megaatmega2560/FrameworkArduino/WInterrupts.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/WInterrupts.c
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/WMath.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/WMath.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/WString.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/WString.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/abi.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/abi.cpp
avr-gcc -o .pioenvs/megaatmega2560/FrameworkArduino/hooks.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/hooks.c
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/main.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/main.cpp
avr-g++ -o .pioenvs/megaatmega2560/FrameworkArduino/new.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/new.cpp
avr-gcc -o .pioenvs/megaatmega2560/FrameworkArduino/wiring.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/wiring.c
avr-gcc -o .pioenvs/megaatmega2560/FrameworkArduino/wiring_analog.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/wiring_analog.c
avr-gcc -o .pioenvs/megaatmega2560/FrameworkArduino/wiring_digital.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/wiring_digital.c
avr-gcc -x assembler-with-cpp -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega -c -o .pioenvs/megaatmega2560/FrameworkArduino/wiring_pulse.S.o /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/wiring_pulse.S
avr-gcc -o .pioenvs/megaatmega2560/FrameworkArduino/wiring_pulse.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/wiring_pulse.c
avr-gcc -o .pioenvs/megaatmega2560/FrameworkArduino/wiring_shift.c.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=30602 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10805 -I/home/max/.platformio/packages/framework-arduinoavr/cores/arduino -I/home/max/.platformio/packages/framework-arduinoavr/variants/mega /home/max/.platformio/packages/framework-arduinoavr/cores/arduino/wiring_shift.c
avr-gcc-ar rc .pioenvs/megaatmega2560/libFrameworkArduino.a .pioenvs/megaatmega2560/FrameworkArduino/CDC.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial0.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial1.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial2.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/HardwareSerial3.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/IPAddress.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/PluggableUSB.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/Print.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/Stream.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/Tone.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/USBCore.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/WInterrupts.c.o .pioenvs/megaatmega2560/FrameworkArduino/WMath.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/WString.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/abi.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/hooks.c.o .pioenvs/megaatmega2560/FrameworkArduino/main.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/new.cpp.o .pioenvs/megaatmega2560/FrameworkArduino/wiring.c.o .pioenvs/megaatmega2560/FrameworkArduino/wiring_analog.c.o .pioenvs/megaatmega2560/FrameworkArduino/wiring_digital.c.o .pioenvs/megaatmega2560/FrameworkArduino/wiring_pulse.S.o .pioenvs/megaatmega2560/FrameworkArduino/wiring_pulse.c.o .pioenvs/megaatmega2560/FrameworkArduino/wiring_shift.c.o
avr-gcc-ranlib .pioenvs/megaatmega2560/libFrameworkArduino.a
avr-g++ -o .pioenvs/megaatmega2560/firmware.elf -Os -mmcu=atmega2560 -Wl,--gc-sections -flto -fuse-linker-plugin .pioenvs/megaatmega2560/src/main.cpp.o -L.pioenvs/megaatmega2560 -Wl,--start-group .pioenvs/megaatmega2560/lib379/libRotary.a .pioenvs/megaatmega2560/libe1a/libSPI.a .pioenvs/megaatmega2560/libd7b/libAdafruit_GFX_Library.a .pioenvs/megaatmega2560/lib3cd/libHX8347D_kbv-master.a .pioenvs/megaatmega2560/libFrameworkArduinoVariant.a .pioenvs/megaatmega2560/libFrameworkArduino.a -lm -Wl,--end-group
MethodWrapper(["checkprogsize"], [".pioenvs/megaatmega2560/firmware.elf"])
avr-objcopy -O ihex -R .eeprom .pioenvs/megaatmega2560/firmware.elf .pioenvs/megaatmega2560/firmware.hex
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   1.1% (used 91 bytes from 8192 bytes)
PROGRAM: [          ]   3.0% (used 7502 bytes from 253952 bytes)
.pioenvs/megaatmega2560/firmware.elf  :
section                     size      addr
.data                         50   8389120
.text                       7452         0
.bss                          41   8389170
.comment                      17         0
.note.gnu.avr.deviceinfo      64         0
.debug_aranges               160         0
.debug_info                 3859         0
.debug_abbrev               2942         0
.debug_line                  732         0
.debug_str                   998         0
Total                      16315
============================================================================================ [SUCCESS] Took 2.34 seconds ============================================================================================

Also the macro -DARDUINO=10805 is passed around so that shouldn’t be a problem. Your platformio.ini doesn’t contain a final line-ending though.

Well, strange that it works for you. Maybe a Windows issue? I reinstalled VSCode and PlatformIO, but still the same problems. Where can I see wich macros (which value for -DARDUINO) are passed?
Also, what kind of final line-ending do I need?

Any newline (\n or \r\n) at the end should suffice

pio run -v

Well, I have no clue why, but after executing pio run -v and restarting the program a few times it is working now…
Thank you very much for your help!

P.S.: Still don’t know how to do the line ending though. If I put a /n at the end it gives my a Syntax error. Could you post the code of a complete working platformio.ini please?

Not a literal \n, I meant the escape code for a newline (\n) and carriage return (\r) respectively. (Newline - Wikipedia). Going into any text editor and just pressing enter and the last line to generate a new empty line should be sufficient.

That is a weird fix, but if it works… Hm.

Thanks again. Maybe it was a late result of reinstalling.

It seems that you used old version of dev/platform. The $ pio update should fix this issue next time.