While compiling Marlin Firmware get fatal error: Missing WProgram.h file for LPC1768 environment

I am using Window 10. I am trying to compile Marlin Firmware for LPC1768 (SKR V1.4) board. I want to use an Adafruit MAX31865 but when I set TEMP_SENSOR_0 to -5 I get a fatal error message during compilation:

Processing LPC1768 (platform: https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip; board: nxp_lpc1768; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc-arduino-lpc176x/nxp_lpc1768.html
PLATFORM: NXP Arduino LPC176x (0.1.3) > NXP LPC1768
HARDWARE: LPC1768 100MHz, 31.97KB RAM, 464KB Flash
DEBUG: Current (cmsis-dap) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES:
 - framework-arduino-lpc176x 0.2.5
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Converting Marlin.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ off, Compatibility ~ strict
Found 3 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Servo> 1.0.0
|-- <Adafruit MAX31865 library> 1.1.0
|-- <U8glib-HAL> 0.4.3
Building in release mode
upload disk:  D:
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\DebugMonitor.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\HAL.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\HAL_SPI.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\MarlinSerial.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\eeprom_flash.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\eeprom_sdcard.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\eeprom_wired.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\fast_pwm.cpp.o    
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\include\digipot_mcp4451_I2C_routines.c.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\include\i2c_util.c.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\main.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\tft\tft_spi.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\tft\xpt2046.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\timers.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\u8g\LCD_I2C_routines.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\u8g\u8g_com_HAL_LPC1768_hw_spi.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\u8g\u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\u8g\u8g_com_HAL_LPC1768_st7920_hw_spi.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\u8g\u8g_com_HAL_LPC1768_st7920_sw_spi.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\u8g\u8g_com_HAL_LPC1768_sw_spi.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\usb_serial.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\LPC1768\watchdog.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\HAL_spi_L6470.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\backtrace\backtrace.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\backtrace\unwmemaccess.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\eeprom_api.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\eeprom_if_i2c.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\eeprom_if_spi.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\esp_wifi.cpp.o
Compiling .pio\build\LPC1768\src\src\HAL\shared\servo.cpp.o
Compiling .pio\build\LPC1768\src\src\MarlinCore.cpp.o
Compiling .pio\build\LPC1768\src\src\core\serial.cpp.o
Compiling .pio\build\LPC1768\src\src\core\utility.cpp.o
Compiling .pio\build\LPC1768\src\src\feature\babystep.cpp.o
Compiling .pio\build\LPC1768\src\src\feature\bedlevel\bedlevel.cpp.o
Compiling .pio\build\LPC1768\src\src\feature\ethernet.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\calibrate\G28.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\config\M200-M205.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\config\M220.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\config\M221.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\config\M301.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\config\M302.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\config\M92.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M108_M112_M410.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M111.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M120_M121.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M17_M18_M84.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M211.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M280.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M350_M351.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M400.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M80_M81.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M85.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M993_M994.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M997.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\M999.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\control\T.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\eeprom\M500-M504.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\feature\digipot\M907-M910.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\feature\network\M552-M554.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\gcode.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\gcode_d.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\geometry\G92.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\geometry\M206_M428.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\host\M110.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\host\M113.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\host\M114.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\host\M115.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\host\M118.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\host\M119.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\lcd\M0_M1.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\lcd\M117.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\lcd\M145.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\lcd\M300.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\motion\G0_G1.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\motion\G2_G3.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\motion\G4.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\motion\M290.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\parser.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\queue.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M1001.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M20.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M21_M22.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M23.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M24_M25.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M26.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M27.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M28_M29.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M30.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M32.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M33.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M34.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M524.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\sd\M928.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\stats\M31.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\stats\M75-M78.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\temp\M104_M109.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\temp\M105.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\temp\M106_M107.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\temp\M140_M190.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\temp\M141_M191.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\temp\M155.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\temp\M303.cpp.o
Compiling .pio\build\LPC1768\src\src\gcode\units\M82_M83.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\lcdprint_u8g.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\marlinui_DOGM.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\status_screen_DOGM.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\status_screen_lite_ST7920.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\u8g_dev_ssd1306_sh1106_128x64_I2C.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\u8g_dev_st7565_64128n_HAL.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\u8g_dev_st7920_128x64_HAL.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\u8g_dev_tft_upscale_from_128x64.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\u8g_dev_uc1701_mini12864_HAL.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\u8g_fontutf8.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\dogm\ultralcd_st7920_u8glib_rrd_AVR.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\extui\ui_api.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\fontutils.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\lcdprint.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\marlinui.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_advanced.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_configuration.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_custom.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_game.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_info.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_main.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_media.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_mixer.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_motion.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_probe_offset.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_temperature.cpp.o
Compiling .pio\build\LPC1768\src\src\lcd\menu\menu_tune.cpp.o
Compiling .pio\build\LPC1768\src\src\libs\buzzer.cpp.o
Compiling .pio\build\LPC1768\src\src\libs\numtostr.cpp.o
Compiling .pio\build\LPC1768\src\src\libs\stopwatch.cpp.o
Compiling .pio\build\LPC1768\src\src\libs\vector_3.cpp.o
Compiling .pio\build\LPC1768\src\src\module\endstops.cpp.o
Compiling .pio\build\LPC1768\src\src\module\motion.cpp.o
Compiling .pio\build\LPC1768\src\src\module\planner.cpp.o
Compiling .pio\build\LPC1768\src\src\module\servo.cpp.o
Compiling .pio\build\LPC1768\src\src\module\settings.cpp.o
Compiling .pio\build\LPC1768\src\src\module\stepper.cpp.o
Compiling .pio\build\LPC1768\src\src\module\stepper\indirection.cpp.o
Compiling .pio\build\LPC1768\src\src\module\temperature.cpp.o
In file included from Marlin\src\module\temperature.cpp:48:
.pio\libdeps\LPC1768\Adafruit MAX31865 library/Adafruit_MAX31865.h:52:10: fatal error: WProgram.h: No such file or directory

******************************************************************
* Looking for WProgram.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:WProgram.h"
* Web  > https://platformio.org/lib/search?query=header:WProgram.h
*
******************************************************************

   52 | #include "WProgram.h"
      |          ^~~~~~~~~~~~
compilation terminated.
*** [.pio\build\LPC1768\src\src\module\temperature.cpp.o] Error 1
================================================================================ [FAILED] Took 107.30 seconds ================================================================================
Environment    Status    Duration
-------------  --------  ------------
LPC1768        FAILED    00:01:47.299
=========================================================================== 1 failed, 0 succeeded in 00:01:47.299 =========================================================================== 
The terminal process "C:\Users\joann\.platformio\penv\Scripts\pio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

How do I fix this?

I’m not a Marlin user/compiler/maintainer – I have not got a 3D printer, so bear that in mind…:wink:

However, I found this marlin issue: Issue compiling branch bugfix-2.0x LPC1768 (MKS SBASE 1.3) · Issue #12475 · MarlinFirmware/Marlin · GitHub which has the same error message as yours.

I get the impression that the person raining the issue had been using an older platformio.ini file and not the one with the (then) latest branch of Marlin. Are you using the correct file?

HTH

Cheers,
Norm.

yes, I am using the plaformio.ini file downloaded with the bugfix-2.0.x branch

The header file, Adafruit_MAX31865.h, which is trying to open WProgram.h has this code:

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

Basically, if the Arduino IDE is at a version greater /equal to 1.0 it looks for Arduino.h otherwise WProgram.h.

Does the Marlin software #define ARDUINO anywhere?

Failing that, you could edit the above header file and change the lines above to just #include "Arduino.h", but it’s better to solve the riddle rather than hack away at the code.

Cheers,
Norm.

Yeh, I figured that out. I am writing up the bug to Marlin now.

1 Like

Here is what I was able to determine: [BUG & Fix] LPC1768 and LPC1769 will not compile when trying to use Adafruit MAX31865 board & PT100 sensor · Issue #20132 · MarlinFirmware/Marlin · GitHub

1 Like

That was an excellent issue report and, indeed, fix. I wish my clients/customers were as thorough when reporting bugs!

Cheers,
Norm.

1 Like