First Defined here, Multiple Definition - Error during Creating Class using another library

Hi,
I am trying to create a library for connecting Ethernet to ESP32 using LAN8720 module. I used the WebServer_WT32_ETH01 for creating that Class. When I created that class and place it in a separate file, it just works fine. But, when I try to create a .cpp file for function definitions, there comes the error.

LAN8720.h

#pragma once

#ifndef LAN8720_H
#define LAN8720_H

#define DEBUG_ETHERNET_WEBSERVER_PORT       Serial
// Debug Level from 0 to 4
#define _ETHERNET_WEBSERVER_LOGLEVEL_       3

#include "Arduino.h"
#include <WebServer_WT32_ETH01.h>

class LAN8720
{
  private:
    // Select the IP address according to your local network
    IPAddress myIP;
    IPAddress myGW;
    IPAddress mySN;
    // Google DNS Server IP
    IPAddress myDNS;

  public:

    LAN8720() {}

    void init();
    void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1);
    void connect();
};

#endif

LAN8720.cpp

#include "LAN8720.h"

void LAN8720::init()
{
    Serial.print("\nStarting HelloServer on " + String(ARDUINO_BOARD));
    Serial.println(" with " + String(SHIELD_TYPE));
    Serial.println(WEBSERVER_WT32_ETH01_VERSION);

    // To be called before ETH.begin()
    WT32_ETH01_onEvent();

    ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER);
}

void LAN8720::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1)
{
    myIP = local_ip;
    myGW = gateway;
    mySN = subnet;
    myDNS = dns1;
    // Static IP, leave without this line to get IP via DHCP
    //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
    ETH.config(myIP, myGW, mySN, myDNS);
}

void LAN8720::connect()
{
    WT32_ETH01_waitForConnect();

    Serial.print(F("HTTP EthernetWebServer is @ IP : "));
    Serial.println(ETH.localIP());
}

errors

c:/users/vignesh/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\lib350\libLAN8720.a(LAN8720.cpp.o):D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:36: multiple definition of `WT32_ETH01_eth_connected'; .pio\build\esp32dev\src\main.cpp.o:D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:36: first defined here     
c:/users/vignesh/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\lib350\libLAN8720.a(LAN8720.cpp.o): in function `WT32_ETH01_event(arduino_event_id_t)':   
D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:55: multiple definition of `WT32_ETH01_event(arduino_event_id_t)'; .pio\build\esp32dev\src\main.cpp.o:D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:55: first defined here
c:/users/vignesh/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\lib350\libLAN8720.a(LAN8720.cpp.o): in function `WT32_ETH01_onEvent()':
D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:39: multiple definition of `WT32_ETH01_onEvent()'; .pio\build\esp32dev\src\main.cpp.o:D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:39: first defined here
c:/users/vignesh/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\lib350\libLAN8720.a(LAN8720.cpp.o): in function `WT32_ETH01_waitForConnect()':
D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:44: multiple definition of `WT32_ETH01_waitForConnect()'; .pio\build\esp32dev\src\main.cpp.o:D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:44: first defined here
c:/users/vignesh/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\lib350\libLAN8720.a(LAN8720.cpp.o): in function `WT32_ETH01_isConnected()':
D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:50: multiple definition of `WT32_ETH01_isConnected()'; .pio\build\esp32dev\src\main.cpp.o:D:\GiT\Vicky\Modular_CPP\LAN8720_OOP/lib/WebServer_WT32_ETH01/src/WebServer_WT32_ETH01_Impl.h:50: first defined here

Can someone help me to solve this problem?

The library code is structured weirdly in only header files, so if multiple .cpp files do

#include <WebServer_WT32_ETH01.h>

(or include a file which has that line), all these files will #include <WebServer_WT32_ETH01_Impl.h> and thus pull in the implementation code, violating the One-Definition-Rule of C/C++.

To prevent this, do as the library says. It’s already written in the library’s readme file.

Thankyou. After seeing that README file, Now I am able to compile the program without any Multiple definition error.