WeMos D1 R2 error compiling

Hi, I have a problem compiling a simple blinking LED for a WeMos D1 R2 board. When I switch the board setting to Arduino Uno, the compiling is ok.Below are the error message and my code:

void setup() {
pinMode(14, OUTPUT); // set the digital pin as output.
void loop() {
digitalWrite(14, HIGH);// turn the LED off.(Note that LOW is the voltage level but actually
                      //the LED is on; this is because it is acive low on the ESP8266.
delay(1000);          // wait for 1 second.
digitalWrite(14, LOW); // turn the LED on.
delay(1000);         // wait for 1 second.

Moderator edit : start code tag added

Please do not post pictures of errors. It is a waste of time

Copy the error message using the "Copy error messages" button and paste them here in code tags

Your sketch compiles without error when I select board: "LOLIN(WEMOS) D1 R2 & mini". It does so for both "ESP8266 Community v2.7.4" and the latest "ESP8266 Community v3.0.0".

The error message says "Error compiling for generic esp8266 module". That's the wrong board to select for the Wemos mini.

1 Like

It was reported here that this error is caused by having the CPLUS_INCLUDE_PATH environment variable defined. Apparently the compiler is affected by this value, which might be useful in non-Arduino applications, but is disastrous when using the Arduino build system.

Ok, thank for your reminder

Sorry for confusing. It happens the same when I select WEMOS D1 R2 board.

Hi, thank for your reply. Anyway, I am still confuse after read the link you sent to me. From the link, the first guy said " If I remove the environment variable CPLUS_INCLUDE_PATH , the blink sketch compiles normally." My question is how to remove environment variable CPLUS_INCLUDE_PATH? Sorry asking this question as I am new to arduino environment.

Do this:

  1. Right click the Windows Start button.
  2. From the menu, click "Run".
  3. In the "Open" field, type "SystemPropertiesAdvanced".
  4. Click the OK button. The "System Properties" window will now open.
  5. Click the "Advanced" tab.
  6. Click the Environment variables... button.
  7. In the "System Variables" list, you should see "CPLUS_INCLUDE_PATH ". Click on it.
  8. Click the Delete button.
  9. Click the OK button.
  10. Click the OK button on the "System Properties" window to close it.

The error should now be fixed.