exit status 1

I have tried many ways. But it still doesn't work.

Error msg:

Arduino:1.8.10 (Windows 10), 开发板:"Arduino Uno"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\16875\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\16875\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries D:\文档\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10810 -build-path C:\Users\16875\AppData\Local\Temp\arduino_build_732554 -warnings=all -build-cache C:\Users\16875\AppData\Local\Temp\arduino_cache_648174 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\16875\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=C:\Users\16875\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -
...

"C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\core.a" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\WString.cpp.o"
"C:\Users\16875\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar" rcs "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\core.a" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\abi.cpp.o"
"C:\Users\16875\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar" rcs "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\core.a" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\main.cpp.o"
"C:\Users\16875\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-gcc-ar" rcs "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\core.a" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\core\new.cpp.o"
Archiving built core (caching) in: C:\Users\16875\AppData\Local\Temp\arduino_cache_648174\core\core_arduino_avr_uno_18dd865a2e1bb8df2a2622362c189e86.a
Linking everything together...
"C:\Users\16875\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\16875\AppData\Local\Temp\arduino_build_732554/AutoWateringSystem.ino.elf" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\sketch\AutoWateringSystem.ino.cpp.o" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\sketch\src\IOobjClass.cpp.o" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554\sketch\src\main.cpp.o" "C:\Users\16875\AppData\Local\Temp\arduino_build_732554/core\core.a" "-LC:\Users\16875\AppData\Local\Temp\arduino_build_732554" -lm
C:\Users\16875\AppData\Local\Temp\arduino_build_732554\sketch\src\main.cpp.o (symbol from plugin): In function `setup':

(.text+0x0): multiple definition of `setup'

C:\Users\16875\AppData\Local\Temp\arduino_build_732554\sketch\AutoWateringSystem.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\16875\AppData\Local\Temp\arduino_build_732554\sketch\src\main.cpp.o (symbol from plugin): In function `setup':

(.text+0x0): multiple definition of `loop'

C:\Users\16875\AppData\Local\Temp\arduino_build_732554\sketch\AutoWateringSystem.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
为开发板 Arduino Uno 编译时出错。

My code:

const int soilMoisturePin = 0; //土壤湿度引脚(A0)
const int pumpPin = 3;         //水泵引脚(3)
int minLevel = 4;              //小于该等级 则需要浇水
int wateringTime = 5000;
int wateringDelay = 1000;

inline String systemMsg(String str) {
 return "@SYSTEM: " + str;
}
inline void doWater()
{
 Serial.print(systemMsg("Watering..."));
 digitalWrite(pumpPin, LOW);//继电器低电平时接通以浇水
 delay(wateringTime);
 digitalWrite(pumpPin, HIGH);
 Serial.println("Done.");
 Serial.println("");
}
inline void stopWater()
{
 digitalWrite(pumpPin,HIGH);
}

void setup()
{
 Serial.begin(9600);
 Serial.println(systemMsg("Serial begin."));
 Serial.println(systemMsg("Start initialization."));
 pinMode(pumpPin, OUTPUT);
 Serial.println(systemMsg("Initialized."));
 Serial.println(systemMsg("Start working."));
 Serial.println("");
}

void loop()
{
 int soilMoistureVal;
 int *tempTotal = new int;
 for (int i = 1; i <= 3; i++)
 {
   *tempTotal += analogRead(soilMoisturePin);
   delay(50);
 }
 soilMoistureVal = (*tempTotal) / 3;
 delete tempTotal;
 Serial.print(systemMsg("Average Moisture Value:"));
 Serial.println(soilMoistureVal);
 int level = map(soilMoistureVal, 0, 1023, 0, 9);
 Serial.print("Level:");
 Serial.println(level);
 Serial.println("");
 if (level < minLevel)
 {
   doWater();
   delay(wateringDelay);
 }
 else
 {
   stopWater();
 }
}

In the Arduino IDE, do you see multiple tabs on the bar underneath the one with the upload and verify buttons?