ModBus TCP with Arduino DUE


I am using an Arduino Due with an Ethernet shield.

I get a compiler error when i add the ArduinoModbus.h library, I have read someone said Arduino Due doesnt work with this library, but i havent found any confirmation on this.
I am trying to use my Arduino due as a ModBus TCP server.

Is there a workaround to this problem?

Arduino: 1.8.16 (Windows Store (Windows 10), Board: "Arduino Due (Programming Port)"

In file included from C:\Users\h�kkjekk\Documents\ArduinoData\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x/variant.h:50:0,

             from C:\Users\h�kkjekk\Documents\ArduinoData\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:201,

             from C:\Users\h�kkjekk\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:23:

C:\Users\h�kkjekk\Documents\ArduinoData\packages\arduino\hardware\sam\1.6.12\cores\arduino/syscalls.h:43:12: error: conflicting types for 'link'

extern int link( char *cOld, char *cNew ) ;


In file included from c:\users\h�kkjekk\documents\arduinodata\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdio.h:29:0,

             from C:\Users\h�kkjekk\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus\modbus.c:11:

c:\users\h�kkjekk\documents\arduinodata\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\sys\unistd.h:118:9: note: previous declaration of 'link' was here

int _EXFUN(link, (const char *__path1, const char *__path2 ));


exit status 1

Error compiling for board Arduino Due (Programming Port).

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

I have also tried in the web-editor. With ArduinoModbus library with the Arduino Due, still error when trying to compile. Must be that the library isnt compatible with the DUE?

This is the only code:

// ArduinoRS485 - Version: Latest
#include <ArduinoRS485.h>

// ArduinoModbus - Version: Latest
#include <ArduinoModbus.h>



void setup() {


void loop() {


@haakonk1234, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

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