error when trying to upload

when i try to upload this code

#include <LiquidCrystal.h>
#include <Adafruit_BMP280.h>
#include <Wire.h>
#include "DHT.h"

#define DHTPIN 8
#define BMP_SCK (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS (10)
Adafruit_BMP280 bmp; // I2C
int interval = 1500;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

void setup() {
lcd.begin(20, 4);
float h = dht.readHumidity();
//read temperature in Fahrenheit
float f = dht.readTemperature();

if (isnan(h) || isnan(f)) {
lcd.print("ERROR");
if (!bmp.begin(0x76)){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Missing Sensor!");
}

lcd.setCursor(0, 0);
lcd.print("BMP280 & LCD1602");
lcd.setCursor(1, 1);
lcd.print("Weatherstation");

delay(interval*3);
lcd.clear();

}

{

lcd.setCursor(3, 0);
lcd.print("Airpressure");
lcd.setCursor(4, 1);
lcd.print(bmp.readPressure());
lcd.print(" hPa");

delay(interval);

lcd.print(f);
lcd.setCursor(7,1);
lcd.print(h);

delay(interval);
lcd.clear();
}}

i get this error

Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\DELL\AppData\Local\Temp\ccpoPCaz.ltrans0.ltrans.o: In function `main':

C:\Users\DELL\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop'

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "LiquidCrystal.h"
Used: C:\Users\DELL\Arduino\libraries\LiquidCrystal
Multiple libraries were found for "Adafruit_BMP280.h"
Used: D:\Documents\Arduino\libraries\Adafruit_BMP280_Library
Not used: D:\Documents\Arduino\libraries\Adafruit_BMP280_Library-master
Multiple libraries were found for "Wire.h"
Used: C:\Users\DELL\Arduino\hardware\arduino\avr\libraries\Wire
Multiple libraries were found for "SPI.h"
Used: C:\Users\DELL\Arduino\hardware\arduino\avr\libraries\SPI
Multiple libraries were found for "DHT.h"
Used: D:\Documents\Arduino\libraries\DHT_sensor_library
Multiple libraries were found for "Adafruit_Sensor.h"
Used: D:\Documents\Arduino\libraries\Adafruit_Unified_Sensor
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

i tried updating the libraries and fresh reinstall for the ide but nothing worked

Hi,

Is that your full code?

I can't see void loop anywhere.

Peter

Peterd51:
Hi,

Is that your full code?

I can't see void loop anywhere.

Peter

yes that is my full code, and no it doesnt have a loop.

No loop makes it an incomplete sketch.

Please READ THIS POST to help you get the best out of the forum.

SIMPLE TROUBLESHOOTING.
These steps may also save you some unnecessary time and effort in the forum.

  • Always provide as much detail as possible to your issue it may be important.
  • If applicable provide your SKETCH inside CODE TAGS ( </> ) or a CREATE share link.
  • If applicable provide a schematic even if hand drawn.
  • How to insert a picture into your post
  • If applicable provide a proper LINK to the hardware / sensors etc. you are using.

Bob.

A code must have a loop function even if it is empty.
Try add this at the end:

void loop() {}