Skip to content

extern millis declaration #84

@BlackEdder

Description

@BlackEdder

I get the follow error with later versions of TaskScheduler/esp:

 In file included from lib/painlessMesh/src/painlessMeshConnection.h:6:0,
                 from lib/painlessMesh/src/painlessMeshConnection.cpp:9:
/root/.platformio/lib/TaskScheduler_ID721/src/TaskSchedulerDeclarations.h:48:22: error: previous declaration of 'long unsigned int millis()' with 'C++' linkage
 extern unsigned long millis(void);
                      ^
In file included from /root/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClient.h:25:0,
                 from /root/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h:39,
                 from lib/painlessMesh/src/painlessMeshConnection.h:11,
                 from lib/painlessMesh/src/painlessMeshConnection.cpp:9:
/root/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:187:26: error: conflicts with new declaration with 'C' linkage
 unsigned long millis(void);
                          ^
In file included from lib/painlessMesh/src/painlessMeshConnection.h:6:0,
                 from lib/painlessMesh/src/painlessMeshConnection.cpp:9:
/root/.platformio/lib/TaskScheduler_ID721/src/TaskSchedulerDeclarations.h:47:22: error: previous declaration of 'long unsigned int micros()' with 'C++' linkage
 extern unsigned long micros(void);
                      ^
In file included from /root/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/WiFiClient.h:25:0,
                 from /root/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h:39,
                 from lib/painlessMesh/src/painlessMeshConnection.h:11,
                 from lib/painlessMesh/src/painlessMeshConnection.cpp:9:
/root/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:188:26: error: conflicts with new declaration with 'C' linkage
 unsigned long micros(void);
                          ^
*** [.pio/build/nodemcuv2/lib771/painlessMesh/painlessMeshConnection.cpp.o] Error 1

I assume this would be solved by wrapping them as follows in the TaskSchedulerDeclarations file (but have not tested this).

extern "C"
{
   unsigned long micros(void);
   unsigned long millis(void);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions