Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't compile #104

Open
yuan8 opened this issue Jun 29, 2023 · 0 comments
Open

can't compile #104

yuan8 opened this issue Jun 29, 2023 · 0 comments

Comments

@yuan8
Copy link

yuan8 commented Jun 29, 2023

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <SocketIoClient.h>

#define USER_SERIAL Serial
const char* ssid="Berjuang";
const char* pass="Bojonegoro03";

SocketIoClient webSocket;
// SocketIoClient io;

void setup(){

  USER_SERIAL.begin(115200);
 
  searchWiFi();
  connectWiFi();
  
  webSocket.on("update",handleMessage);
  delay(1000);
  webSocket.begin("192.168.0.226",3000,"socket.io?transport=websocket");

  

}

void searchWiFi(){
   int numberOfNetwork=WiFi.scanNetworks();
  USER_SERIAL.println("-------");
  for(int i=0;i< numberOfNetwork;i++){
    USER_SERIAL.print("NETWORK NAME: ");
    USER_SERIAL.print(WiFi.SSID(i));
    USER_SERIAL.print(" SIGNAL: ");
    USER_SERIAL.println(WiFi.RSSI(i));
    USER_SERIAL.println("------------------------------------");
  }

}

void handleMessage(const char* message,size_t length){
    USER_SERIAL.println(message);
}

void connectWiFi(){
  WiFi.begin(ssid,pass);
  while(WiFi.status()!=WL_CONNECTED){
    USER_SERIAL.print(".");
    delay(1000);
  }

  USER_SERIAL.println("");
  USER_SERIAL.println("WiFI connected");
  USER_SERIAL.print("IP ADRRESS : ");
  USER_SERIAL.print(WiFi.localIP());
  USER_SERIAL.println("-----------------");

}


void loop(){
  webSocket.loop();
}

i dont know why...

/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_Z12getEventName6String':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:3: multiple definition of `_Z12getEventName6String'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:3: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_Z15getEventPayload6String':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:7: multiple definition of `_Z15getEventPayload6String'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:7: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient14webSocketEventE8WStype_tPhj':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:18: multiple definition of `_ZN14SocketIoClient14webSocketEventE8WStype_tPhj'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:18: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient10initializeEv':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:62: multiple definition of `_ZN14SocketIoClient10initializeEv'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:60: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient5beginEPKciS1_':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:57: multiple definition of `_ZN14SocketIoClient5beginEPKciS1_'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:55: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient8beginSSLEPKciS1_S1_':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:46: multiple definition of `_ZN14SocketIoClient8beginSSLEPKciS1_S1_'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:46: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient4loopEv':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:67: multiple definition of `_ZN14SocketIoClient4loopEv'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:65: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient7triggerEPKcS1_j':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:101: multiple definition of `_ZN14SocketIoClient7triggerEPKcS1_j'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:99: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient10disconnectEv':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:112: multiple definition of `_ZN14SocketIoClient10disconnectEv'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:110: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient16setAuthorizationEPKcS1_':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:118: multiple definition of `_ZN14SocketIoClient16setAuthorizationEPKcS1_'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:116: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient4emitEPKcS1_':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:88: multiple definition of `_ZN14SocketIoClient4emitEPKcS1_'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:86: first defined here
/Users/yone/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient.cpp.o: in function `_ZN14SocketIoClient2onEPKcSt8functionIFvS1_jEE':
/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:84: multiple definition of `_ZN14SocketIoClient2onEPKcSt8functionIFvS1_jEE'; /private/var/folders/d1/_9yj0yhn1sj_mkxn7b10n9y00000gn/T/arduino/sketches/911A6D26F4D1A762F0B073B388189562/libraries/SocketIoClient/SocketIoClient 2.cpp.o:/Users/yone/Documents/Arduino/libraries/SocketIoClient/SocketIoClient 2.cpp:82: first defined here
collect2: error: ld returned 1 exit status

Using library ESP8266WiFi at version 1.0 in folder: /Users/yone/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/ESP8266WiFi 
Using library SocketIoClient at version 0.3 in folder: /Users/yone/Documents/Arduino/libraries/SocketIoClient 
Using library WebSockets at version 2.4.0 in folder: /Users/yone/Documents/Arduino/libraries/WebSockets 
Using library Hash at version 1.0 in folder: /Users/yone/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/libraries/Hash 
exit status 1

Compilation error: exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant