Hello, i know this is probably not the place to put this but i am in dire need of help. i am quite new to ardinou and ive got a problem which im struggling to find the cause of. Ive downloaded current versions of drivers aswell as Ardinou IOT. Can anyone help me with this error as im not actually sure what its referring to.
All the code is trying to do is connect to the internet and output a message to say its successful. I am using a NodeMCU.
`//USING A NODEMCU TO TRAIL CONNECTING TO WIFI, NOT WORKING AT ALL, KEEP GETTING ERROR MESSAGE WHICH APPEARS AT THE BOTTOM//
//TRIED INSTALLING MANY DRIVERS INCLUDING THE ESP8266.H,DHT,ADAFRUIT... NOTHING WORKS//
/Users/alexmarkham/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/td/xrdny6fd307g12t9r8vp_gcc0000gn/T/arduino/sketches/77C3C0DE0834D07A72E8DF362DFA5C31/core/core.a(core_esp8266_main.cpp.o): in function `__loop_end':
/Users/alexmarkham/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/cores/esp8266/core_esp8266_main.cpp:245: undefined reference to `loop'
/Users/alexmarkham/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/td/xrdny6fd307g12t9r8vp_gcc0000gn/T/arduino/sketches/77C3C0DE0834D07A72E8DF362DFA5C31/core/core.a(core_esp8266_main.cpp.o): in function `_ZL12loop_wrapperv':
/Users/alexmarkham/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/cores/esp8266/core_esp8266_main.cpp:250: undefined reference to `loop'
collect2: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
Moderator edit: password redacted; code tags added
Hi @alexmnoobie. Every Arduino sketch must have a setup function and a loop function. When the loop function is missing from the sketch, as is the case with the sketch you shared here, you get this "undefined reference to 'loop'" error.
So the solution is to add the missing required function. If you don't have any code that needs to be put in the function, you can simply leave it empty:
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.
/Users/alexmarkham/Documents/Arduino/ESPTEST/ESPTEST.ino:21:1: error: 'WiFi' does not name a type
21 | WiFi.begin(ssid , password);
| ^~~~
/Users/alexmarkham/Documents/Arduino/ESPTEST/ESPTEST.ino:23:1: error: 'Serial' does not name a type
23 | Serial.println();
| ^~~~~~
/Users/alexmarkham/Documents/Arduino/ESPTEST/ESPTEST.ino:24:1: error: 'Serial' does not name a type
24 | Serial.print("connecting");
| ^~~~~~
/Users/alexmarkham/Documents/Arduino/ESPTEST/ESPTEST.ino:26:1: error: expected unqualified-id before 'while'
26 | while(WiFi.status() != WL_CONNECTED ){
| ^~~~~
/Users/alexmarkham/Documents/Arduino/ESPTEST/ESPTEST.ino:30:13: error: expected constructor, destructor, or type conversion before '(' token
30 | digitalWrite(ledPin,HIGH);
| ^
/Users/alexmarkham/Documents/Arduino/ESPTEST/ESPTEST.ino:31:1: error: 'Serial' does not name a type
31 | Serial.println();
| ^~~~~~
/Users/alexmarkham/Documents/Arduino/ESPTEST/ESPTEST.ino:32:1: error: expected unqualified-id before '{' token
32 | {
| ^
exit status 1
Compilation error: 'WiFi' does not name a type```
type or paste code here