how can i use WiFiUdp in esp8266??

i make this code to use wifi udp in esp8266. but multiple library error occured. how can i fix or use udp??

using this library

c:/users/parktong/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiUdp.cpp.o):(.rodata._ZTV7WiFiUDP[vtable for WiFiUDP]+0x40): undefined reference to `WiFiUDP::beginPacket(char const*, unsigned short)'

collect2.exe: error: ld returned 1 exit status

"SPI.h"를 위한 복수개의 라이브러리가 발견되었습니다
 사용됨: C:\Users\parktong\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\SPI
"ESP8266WiFi.h"를 위한 복수개의 라이브러리가 발견되었습니다
 사용됨: C:\Users\parktong\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi
"MFRC522.h"를 위한 복수개의 라이브러리가 발견되었습니다
 사용됨: C:\Program
exit status 1
보드 Generic ESP8266 Module 컴파일 에러.
//this doesn't work
#ifndef RST_PIN
#define RST_PIN   9
#define SS_PIN    10
#define transmit_en_pin 4
#endif

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <MFRC522.h>
#include <SPI.h>

MFRC522 mfrc(SS_PIN, RST_PIN);
WiFiUDP udp;

byte drone[6][4];
char wifi_list_of_dron[6][50] = {};  //텔로 wifi 이름 추가
char main_wifi[] = ""; //중앙 통신용 wifi 이름 추가
int connected_drons = 0;
unsigned int com_port = 9000;

void connect_wifi(char ssid[])
{
  WiFi.begin(ssid);

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(250);
    Serial.print(".");
  }
  Serial.println();

  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
}

void Send(char ssid[], char message[])
{
  connect_wifi(ssid);

  /*
  udp.begin((uint16_t)com_port);
  IPAddress ip = WiFi.localIP();
  udp.beginPacket(ip, (uint16_t)com_port);
  udp.write(message);

  udp.endPacket();
  */
  WiFi.disconnect();
  delay(100);
}

void setup()
{
  Serial.begin(115200);
  delay(250);

  SPI.begin();
  mfrc.PCD_Init();

  int retries = 0;
  while ((WiFi.status() != WL_CONNECTED) && (retries < 10)) {
    retries++;
    delay(500);
    Serial.print(".");
  }
  if (WiFi.status() == WL_CONNECTED) {
    Serial.println(F("WiFi connected"));
  }
}




void loop()
{
 if (connected_drons < 6)
  {
    //read the rfid tag
    if ( !mfrc.PICC_IsNewCardPresent() || !mfrc.PICC_ReadCardSerial() )
    {
      delay(500);
      return;
    }
    Serial.print("\n");
    Serial.print("Card UID:");
    for (int i = 0; i < 4; i++)
    {
      Serial.print(mfrc.uid.uidByte[i], HEX);
      drone[connected_drons][i] = (mfrc.uid.uidByte[i]);
      Serial.print(" ");
    }
    Serial.print("\n");
    Serial.print("drone ");
    Serial.print(connected_drons + 1);
    Serial.print(" :");

    for (byte k = 0; k < 4; k++)
    {
      Serial.print(drone[connected_drons][k], HEX);
      Serial.println(" ");
    }

    connected_drons++;
  }



  else
  {
    //main code

  }
  delay(100);
}
//this works
#ifndef RST_PIN
#define RST_PIN   9
#define SS_PIN    10
#define transmit_en_pin 4
#endif

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <MFRC522.h>
#include <SPI.h>

MFRC522 mfrc(SS_PIN, RST_PIN);
//WiFiUDP udp;

byte drone[6][4];
char wifi_list_of_dron[6][50] = {};  //텔로 wifi 이름 추가
char main_wifi[] = ""; //중앙 통신용 wifi 이름 추가
int connected_drons = 0;
unsigned int com_port = 9000;

void connect_wifi(char ssid[])
{
  WiFi.begin(ssid);

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(250);
    Serial.print(".");
  }
  Serial.println();

  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
}

void Send(char ssid[], char message[])
{
  connect_wifi(ssid);

  udp.begin((uint16_t)com_port);
  IPAddress ip = WiFi.localIP();
  udp.beginPacket(ip, (uint16_t)com_port);
  udp.write(message);

  udp.endPacket();
  WiFi.disconnect();
  delay(100);
}

void setup()
{
  Serial.begin(115200);
  delay(250);

  SPI.begin();
  mfrc.PCD_Init();

  int retries = 0;
  while ((WiFi.status() != WL_CONNECTED) && (retries < 10)) {
    retries++;
    delay(500);
    Serial.print(".");
  }
  if (WiFi.status() == WL_CONNECTED) {
    Serial.println(F("WiFi connected"));
  }
}




void loop()
{
 if (connected_drons < 6)
  {
    //read the rfid tag
    if ( !mfrc.PICC_IsNewCardPresent() || !mfrc.PICC_ReadCardSerial() )
    {
      delay(500);
      return;
    }
    Serial.print("\n");
    Serial.print("Card UID:");
    for (int i = 0; i < 4; i++)
    {
      Serial.print(mfrc.uid.uidByte[i], HEX);
      drone[connected_drons][i] = (mfrc.uid.uidByte[i]);
      Serial.print(" ");
    }
    Serial.print("\n");
    Serial.print("drone ");
    Serial.print(connected_drons + 1);
    Serial.print(" :");

    for (byte k = 0; k < 4; k++)
    {
      Serial.print(drone[connected_drons][k], HEX);
      Serial.println(" ");
    }

    connected_drons++;
  }



  else
  {
    //main code

  }
  delay(100);
}

jjun020:
i make this code to use wifi udp in esp8266. but multiple library error occured.

You're misunderstanding the output. There is no "multiple library error". You need to take the time to study the output and understand what it's trying to tell you. This:

jjun020:

"MFRC522.h"를 위한 복수개의 라이브러리가 발견되었습니다

사용됨: C:\Program
"SPI.h"를 위한 복수개의 라이브러리가 발견되었습니다
사용됨: C:\Users\parktong\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\SPI
"ESP8266WiFi.h"를 위한 복수개의 라이브러리가 발견되었습니다
사용됨: C:\Users\parktong\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi

Is just some helpful information provided by the Arduino IDE. It is telling you that it found multiple libraries that contain those files and which of the multiple libraries it decided to use. As long as it picked the right one, you can just ignore the message. Actually, this is not so useful in this particular case because there is a bug in Arduino IDE 1.8.10 that causes spurious "Multiple libraries found" messages even when there were no multiple libraries. Anyway, just ignore it.

Here is the real error that you need to fix:

jjun020:

C:\Users\parktong\Desktop\new_InD\new_InD.ino: In function 'void Send(char*, char*)':

new_InD:42:19: error: 'ip' was not declared in this scope

udp.beginPacket(ip, (uint16_t)com_port);

^

The clue is the part where it says "error".

I don't understand what the deal is with your "this doesn't work" code. In that code, you have commented out the line that generated the error, so I know that isn't the code you're compiling. Then in your "this works" code, you have uncommented those lines, but if it works, what's the problem?

thank you for your reply but i'm so sorry not to upload present error message. i fixed that error but uploaded previous message.

c:/users/parktong/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiUdp.cpp.o):(.rodata._ZTV7WiFiUDP[vtable for WiFiUDP]+0x40): undefined reference to `WiFiUDP::beginPacket(char const*, unsigned short)'

collect2.exe: error: ld returned 1 exit status

"SPI.h"를 위한 복수개의 라이브러리가 발견되었습니다
 사용됨: C:\Users\parktong\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\SPI
"ESP8266WiFi.h"를 위한 복수개의 라이브러리가 발견되었습니다
 사용됨: C:\Users\parktong\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi
"MFRC522.h"를 위한 복수개의 라이브러리가 발견되었습니다
 사용됨: C:\Program
exit status 1
보드 Generic ESP8266 Module 컴파일 에러.

this one is present error message.

Do you get this error when you compile the exact "this doesn't work" sketch you posted above? If not, then post the code you're compiling.

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded the MFRC522 library from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.