Error compiling esp8266 combine with DMD2 library

Hi,
I try to make a project esp8266 with P10 display. I found an example from

After I compile found error:
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Compile error if these two libraries are combined. Although these libraries can be compiled separately. I tried to separate the program into two programs

Here are two program that can compiled.
Program1

//************************************************************************
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

char MESSAGE[255]; //Store the message

const char MAIN_page[] PROGMEM = R"=====(
<!DOCTYPE html>
<html>
<body>
<center>
<h1>Matrix Display Controller<h1>
<form action="/action_page">
  Enter Text :<br><br>
  <input type="text" name="msg" value="Enter your text here">
  <br><br>
  <input type="submit" value="Submit">
</form> 
</center>
</body>
</html>
)=====";

//SSID and Password of your WiFi router
const char* ssid = "ssid_name";
const char* password = "password";

ESP8266WebServer server(80); //Server on port 80

void handleRoot() {
 String s = MAIN_page; //Read HTML contents
 server.send(200, "text/html", s); //Send web page
}
void handleForm() {
  String msg = server.arg("msg"); 
  int msg_len = msg.length() + 1; 
  MESSAGE[msg_len];
  msg.toCharArray(MESSAGE, msg_len);

  String s = MAIN_page;
  server.send(200, "text/html", s); 
  
  //Scroll();
}
void setup(void){
  Serial.begin(115200);
  
  WiFi.begin(ssid, password);     //Connect to your WiFi router
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  //If connection successful show IP address in serial monitor
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println("WiFi");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());  //IP address assigned to your ESP

  server.on("/", handleRoot);      //Which routine to handle at root location
  server.on("/action_page", handleForm); //form action is handled here

  server.begin();                  //Start server
  Serial.println("HTTP server started");
  
  //dmd.setBrightness(255);
  //dmd.selectFont(FONT);
  //dmd.begin();
}

void loop(void){
  server.handleClient();          //Handle client requests
}
//************************************************************************


Program2

//************************************************************************
#include <SPI.h>
#include <DMD2.h>
#include <fonts/Arial14.h>

// Set Width and Hight to the number of displays you have
const int WIDTH = 1;
const int HIGHT = 1;

const uint8_t *FONT = Arial14;

SPIDMD dmd(WIDTH , HIGHT, 5, 16, 2, 12);  // DMD controls the entire display
DMD_TextBox box(dmd);  // "box" provides a text box to automatically write to/scroll the display
char MESSAGE[255]; //Store the message

void Scroll(){
  const char *next = MESSAGE;
  while(*next) {
    Serial.print(*next);
    box.print(*next);
    delay(200);
    next++;
  }
}

void setup(void){
  Serial.begin(115200);
  dmd.setBrightness(255);
  dmd.selectFont(FONT);
  dmd.begin();
}

void loop(void){
  Scroll();
}
//************************************************************************

What the error cause?
Thank you very much.

I'm going to ask you to post some additional information that might help us to identify the problem.

Please do this:

  1. When you encounter an error, you'll see a button on the right side of the orange bar in the Arduino IDE: Copy error messages (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button.
  2. Open a forum reply here by clicking the Reply button.
  3. Click the </> icon on the post composer toolbar. This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  4. Press Ctrl+V. This will paste the compilation output into the code block.
  5. Move the cursor outside of the code block markup before you add any additional text to your reply.
  6. Click the Reply button to post the output.

Hi,
Thank you for response.
here is the error for the original program from the website.

Arduino: 1.8.0 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:3MB OTA:~512KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Build options changed, rebuilding all
In file included from c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\memory:81:0,

                 from C:\tmp18\arduino1-8-2\portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:28,

                 from C:\tmp18\arduino1-8-2\portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:28,

                 from C:\tmp18\arduino1-8-2\portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,

                 from C:\tmp18\arduino1-8-2\project\P10_web\P10_web.ino:1:

c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits\unique_ptr.h: In instantiation of 'void std::unique_ptr<_Tp, _Dp>::reset(std::unique_ptr<_Tp, _Dp>::pointer) [with _Tp = HTTPUpload; _Dp = std::default_delete<HTTPUpload>; std::unique_ptr<_Tp, _Dp>::pointer = HTTPUpload*]':

C:\tmp18\arduino1-8-2\portable\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WebServer\src/ESP8266WebServer-impl.h:365:26:   required from 'void esp8266webserver::ESP8266WebServerTemplate<ServerType>::handleClient() [with ServerType = WiFiServer]'

C:\tmp18\arduino1-8-2\project\P10_web\P10_web.ino:108:23:   required from here

c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits\unique_ptr.h:260:29: error: call of overloaded 'swap(HTTPUpload*&, HTTPUpload*&)' is ambiguous

  swap(std::get<0>(_M_t), __p);

                             ^

c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits\unique_ptr.h:260:29: note: candidates are:

In file included from c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_pair.h:59:0,

                 from c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\utility:70,

                 from c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\algorithm:60,

                 from C:\tmp18\arduino1-8-2\portable\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/Arduino.h:238,

                 from sketch\P10_web.ino.cpp:1:

c:\tmp18\arduino1-8-2\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2\bits\move.h:166:5: note: void std::swap(_Tp&, _Tp&) [with _Tp = HTTPUpload*]

     swap(_Tp& __a, _Tp& __b)

     ^

In file included from C:\tmp18\arduino1-8-2\project\P10_web\P10_web.ino:6:0:

C:\tmp18\arduino1-8-2\portable\sketchbook\libraries\DMD2-0.0.3/DMD2.h:45:41: note: void swap(T&, T&) [with T = HTTPUpload*]

 template<typename T> static inline void swap(T &a, T &b)

                                         ^

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Is there any reason you're using the 2.7.4 version of the ESP8266 boards platform?

I just tried compiling that ESP_DMD_WebServer sketch and had no problems, but I'm using the latest 3.0.0 version of the ESP8266 boards platform.

If you don't have any specific reasons for using the outdated version, please update by following these instructions:

  1. Select Tools > Board > Boards Manager from the Arduino IDE's menus.
  2. Wait for the updates to finish.
  3. Scroll down through the list of boards platforms until you see "esp8266 by ESP8266 Community". Click on it.
  4. Click the Update button.
  5. Wait for the installation to finish.
  6. Click the Close button.

Now try compiling the ESP_DMD_WebServer sketch again.

this is strange, because programs number 1 and 2 can be compiled separately. And it will be an error if the two programs are combined.

Please post the exact code that is causing the error.

From your original description:

It seemed clear that you were compiling the ESP_DMD_WebServer sketch when you got the error, but now I'm not so sure.

Now the program can compiled without error with esp8266 board latest version 3.
Thank you very much for help.

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.