Ethernet2.h and MySQL_Connection.h

Hello,
I have an error in the compilation when using the following libraries: 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <SPI.h> // for Ethernet
#include <SD.h> // for FRAM to work

#include <Ethernet2.h> // use Industruino version
//#include <Ethernet.h> // FOR TESTING

#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>


Test with the ethernet.h library, the compilation goes all the way.
Hands, of course, the ethernet.h library does not work with lndustruino 

Sincerely

Translated with www.DeepL.com/Translator

 

ERROR:

 

In file included from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Packet.h:36:0,
                 from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Connection.h:37,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:39:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src/Ethernet.h:74:7: error: redefinition of 'class EthernetClass'
 class EthernetClass {
       ^
In file included from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:35:0:
D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/Ethernet2.h:22:7: error: previous definition of 'class EthernetClass'
 class EthernetClass {
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Packet.h:36:0,
                 from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Connection.h:37,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:39:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src/Ethernet.h:152:7: error: redefinition of 'class EthernetUDP'
 class EthernetUDP : public UDP {
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/Dhcp.h:7:0,
                 from D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/Ethernet2.h:18,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:35:
D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/EthernetUdp2.h:50:7: error: previous definition of 'class EthernetUDP'
 class EthernetUDP : public UDP {
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Packet.h:36:0,
                 from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Connection.h:37,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:39:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src/Ethernet.h:214:7: error: redefinition of 'class EthernetClient'
 class EthernetClient : public Client {
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/Ethernet2.h:16:0,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:35:
D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/EthernetClient.h:8:7: error: previous definition of 'class EthernetClient'
 class EthernetClient : public Client {
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Packet.h:36:0,
                 from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Connection.h:37,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:39:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src/Ethernet.h:253:7: error: redefinition of 'class EthernetServer'
 class EthernetServer : public Server {
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/Ethernet2.h:17:0,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:35:
D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/EthernetServer.h:8:7: error: previous definition of 'class EthernetServer'
 class EthernetServer : 
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Packet.h:36:0,
                 from D:\Laseris\Mes documents\Arduino\libraries\MySQL_Connector_Arduino\src/MySQL_Connection.h:37,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:39:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src/Ethernet.h:272:7: error: redefinition of 'class DhcpClass'
 class DhcpClass {
       ^
In file included from D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/Ethernet2.h:18:0,
                 from D:\Laseris\Mes documents\Arduino\sketch_Ethernet_Exemple_38___Mysql_v2\sketch_Ethernet_Exemple_38___Mysql_v2.ino:35:
D:\Laseris\Mes documents\Arduino\libraries\Ethernet2\src/Dhcp.h:139:7: error: previous definition of 'class DhcpClass'
 class DhcpClass {
       ^
exit status 1
Error compiling for board Industruino D21G.

AlainG
AlainG
20
| 1 1 1
Asked on 11/4/19, 8:13 PM
0
vote
10421 Views

hi, there is a header file in the mysql library that also includes the Ethernet.h library; i think if you change that to Ethernet2.h it may work:

https://github.com/ChuckBell/MySQL_Connector_Arduino/blob/master/src/MySQL_Packet.h  line 42 

Tom
Tom
5675
| 1 1 3
Answered on 11/4/19, 11:29 PM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

58 follower(s)

Stats

Asked: 11/4/19, 8:13 PM
Seen: 10421 times
Last updated: 11/4/19, 11:29 PM