Newbie Problems with build

Hi All
I am trying to move from Arduino IDE to PlatformIO and its a very step learning curve
I have build the code previously in Arduino IDE and have had it run successfully but had a few little issues so I thought I would migrate my build to here but have got more issues that I cant find solutions for.
Its failed and I don’t know why. I am also a newbie in code writing so be gentle.
My Code is this

#include <Arduino.h>

#include <WiFi.h>
#include <HTTPClient.h>
#include <HX711.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <DHT.h>

#define calibration_factor -21500.0 
#define zero_factor 8364129

#define LOADCELL_DOUT_PIN  22
#define LOADCELL_SCK_PIN  23


// Replace with your network credentials
const char* ssid     = "....";
const char* password = "....";

// REPLACE with your Domain name and URL path or IP address with path
const char* serverName = ".....";

// Keep this API Key value to be compatible with the PHP code provided in the       project page. 
// If you change the apiKeyValue value, the PHP file /post-data.php also needs to have the same key 
String apiKeyValue = "....";

#define DHTPIN 4     // Digital pin connected to the DHT sensor

#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321

#define ONE_WIRE_BUS 15 // Data wire is connected to GPIO15

HX711 scale;

// Setup a oneWire instance to communicate with a OneWire device
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensor 
DallasTemperature sensors(&oneWire);

DeviceAddress sensor1 = { 0x28, 0x6A, 0x48, 0x7C, 0x0C, 0x00, 0x00, 0xC4 }; // long
DeviceAddress sensor2 = { 0x28, 0xFA, 0x14, 0x7B, 0x0C, 0x00, 0x00, 0x47 }; //short

DHT dht(DHTPIN, DHTTYPE);



// Time to sleep
uint64_t uS_TO_S_FACTOR = 1000000;  // Conversion factor for micro seconds to seconds
// sleep for 30 minutes = 1800 seconds
uint64_t TIME_TO_SLEEP = 1800;


// Get Sensor Readings 
String getSensorReadings() {
  sensors.requestTemperatures();
}
 void setup() {
   Serial.begin(9600);
   sensors.begin();
  dht.begin();
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  scale.set_scale(calibration_factor); //This value is obtained by using the       SparkFun_HX711_Calibration sketch
  scale.set_offset(zero_factor); //Zero out the scale using a previously known zero_factor

  WiFi.begin(ssid, password);
  Serial.println("Connecting");
  while(WiFi.status() != WL_CONNECTED) { 
    delay(500);
  Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to WiFi network with IP Address: ");
  Serial.println(WiFi.localIP());

// enable timer deep sleep
    esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);    

}

void loop(){ 

 Serial.println("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
 // Serial.println("DONE");

  Serial.print("8 Frame Hive: ");
  Serial.print(sensors.getTempC(sensor1)); 
  Serial.print("°C:    ");


  Serial.print("10 Frame Hive: ");
  Serial.print(sensors.getTempC(sensor2)); 
  Serial.print("°C:    ");

  Serial.print("Weight ");
  Serial.print(scale.get_units(), 1);
 Serial.print(" Kgs      "); 

   // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();

 // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    Serial.println(F("Failed to read from DHT sensor!"));
   return;
 }

  Serial.print(F("8 Frame Roof Temp: "));
  Serial.print(t);
  Serial.print(F("°C   "));
  Serial.print(F("8 Frame Roof Humidity: "));
  Serial.print(h);
  Serial.print(F("%   "));
  Serial. print('\n');
 delay(5000);

//Check WiFi connection status
 if(WiFi.status()== WL_CONNECTED){
   HTTPClient http;

    // Your Domain name with URL path or IP address with path
   http.begin(serverName);

// Specify content-type header
http.addHeader("Content-Type", "application/x-www-form-urlencoded");

// Prepare your HTTP POST request data
String httpRequestData = "api_key=" + apiKeyValue + "&value1=" + String(dht.readTemperature())
                       + "&value2=" + String(dht.readHumidity()) + "&value3=" +   String(sensors.getTempC(sensor1)) + "&value4=" + String(sensors.getTempC(sensor2))+ "&value5=" + String(scale.get_units(), 1) +"";
Serial.print("httpRequestData: ");
Serial.println(httpRequestData);


// Send HTTP POST request
int httpResponseCode = http.POST(httpRequestData);
 
// If you need an HTTP request with a content type: text/plain
//http.addHeader("Content-Type", "text/plain");
//int httpResponseCode = http.POST("Hello, World!");

// If you need an HTTP request with a content type: application/json, use the following:
//http.addHeader("Content-Type", "application/json");
//int httpResponseCode = http.POST("{\"value1\":\"19\",\"value2\":\"67\",\"value3\":\"78\"}");

if (httpResponseCode>0) {
  Serial.print("HTTP Response code: ");
  Serial.println(httpResponseCode);
   }
   else {
  Serial.print("Error code: ");
  Serial.println(httpResponseCode);
}
// Free resources
http.end();
  }
 else {
    Serial.println("WiFi Disconnected");
 }
//  //Send an HTTP POST request every 30 seconds
//  delay(30000);  
//   // Wait a few seconds between measurements.
//  delay(20000);



 Serial.println("Going to sleep now");
    // start deep sleep for 1800 seconds (30 minutes) 
 esp_deep_sleep_start();

}

And My Build log is

      Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1;  framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-  devkit-v1.html
PLATFORM: Espressif 32 (3.3.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule,  olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
 LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
 LDF Modes: Finder ~ chain, Compatibility ~ soft
 Found 33 compatible libraries
 Scanning dependencies...
 Dependency Graph
 |-- <HX711> 0.7.4
 |-- <OneWire> 2.3.5
 |-- <DallasTemperature> 3.9.1
 |   |-- <OneWire> 2.3.5
 |-- <DHT sensor library> 1.4.2
 |   |-- <Adafruit Unified Sensor> 1.1.4
 |-- <Adafruit Unified Sensor> 1.1.4
 |-- <HTTPClient> 1.2
 |   |-- <WiFi> 1.0
 |   |-- <WiFiClientSecure> 1.0
 |   |   |-- <WiFi> 1.0
 |-- <WiFi> 1.0
 Building in release mode
 Compiling .pio\build\esp32doit-devkit-v1\src\Sparkfun Calibration JP.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\src\Temp Humidity and weight v1.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\src\main.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\lib5b4\HX711\HX711.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\libb25\OneWire\OneWire.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\liba08\DallasTemperature  \DallasTemperature.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\libf67\Adafruit Unified   Sensor\Adafruit_Sensor.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib7f8\DHT sensor library\DHT.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib7f8\DHT sensor library\DHT_U.cpp.o
src\Temp Humidity and weight v1.cpp: In function 'String getSensorReadings()':
src\Temp Humidity and weight v1.cpp:57:1: warning: no return statement in function  returning non-void [-Wreturn-type]
 }
^
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp: In member function 'uint8_t   OneWire::reset()':
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp:167:24: warning: unused  variable 'reg' [-Wunused-variable]
  volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
                    ^
  .pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp: In member function 'void    OneWire::write_bit(uint8_t)':
 .pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp:201:24: warning: unused variable 'reg' [-Wunused-variable]
  volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
                    ^
 .pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp: In member function 'uint8_t  OneWire::read_bit()':
 .pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp:229:24: warning: unused variable 'reg' [-Wunused-variable]
    volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
                    ^
  Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\ETH.cpp.o
  Archiving .pio\build\esp32doit-devkit-v1\lib5b4\libHX711.a
  Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFi.cpp.o
  Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiAP.cpp.o
  Archiving .pio\build\esp32doit-devkit-v1\libb25\libOneWire.a
  Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiClient.cpp.o
  Archiving .pio\build\esp32doit-devkit-v1\libf67\libAdafruit Unified Sensor.a
 Archiving .pio\build\esp32doit-devkit-v1\liba08\libDallasTemperature.a
 Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiGeneric.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiMulti.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiSTA.cpp.o
 Archiving .pio\build\esp32doit-devkit-v1\lib7f8\libDHT sensor library.a
 Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiScan.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiServer.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\lib80b\WiFi\WiFiUdp.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\lib1eb\WiFiClientSecure \WiFiClientSecure.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\lib1eb\WiFiClientSecure\ssl_client.cpp.o
 Compiling .pio\build\esp32doit-devkit-v1\libe26\HTTPClient\HTTPClient.cpp.o
 Archiving .pio\build\esp32doit-devkit-v1\lib80b\libWiFi.a
 Archiving .pio\build\esp32doit-devkit-v1\lib1eb\libWiFiClientSecure.a
 Archiving .pio\build\esp32doit-devkit-v1\libe26\libHTTPClient.a
 Linking .pio\build\esp32doit-devkit-v1\firmware.elf
  .pio\build\esp32doit-devkit-v1\src\Temp Humidity and weight v1.cpp.o: (.bss.scale+0x0): multiple definition of `scale'
  .pio\build\esp32doit-devkit-v1\src\Sparkfun Calibration JP.cpp.o:(.bss.scale+0x0): first defined here
  .pio\build\esp32doit-devkit-v1\src\Temp Humidity and weight v1.cpp.o: In function   `setup()':
  Temp Humidity and weight v1.cpp:(.text._Z5setupv+0x0): multiple definition of `setup()'
 .pio\build\esp32doit-devkit-v1\src\Sparkfun Calibration JP.cpp.o:Sparkfun   Calibration JP.cpp:(.text._Z5setupv+0x0): first defined here
 .pio\build\esp32doit-devkit-v1\src\main.cpp.o: In function `setup()':
main.cpp:(.text._Z5setupv+0x0): multiple definition of `setup()'
 .pio\build\esp32doit-devkit-v1\src\Sparkfun Calibration JP.cpp.o:Sparkfun  Calibration JP.cpp:(.text._Z5setupv+0x0): first defined here
 .pio\build\esp32doit-devkit-v1\src\main.cpp.o: In function `loop()':
  main.cpp:(.text._Z4loopv+0x0): multiple definition of `loop()'
 .pio\build\esp32doit-devkit-v1\src\Temp Humidity and weight v1.cpp.o:Temp        Humidity and weight v1.cpp:(.text._Z4loopv+0x0): first defined here
  collect2.exe: error: ld returned 1 exit status
  *** [.pio\build\esp32doit-devkit-v1\firmware.elf] Error 1
================================================= [FAILED] Took 32.24 seconds =================================================
 The terminal process "C:\Users\jcp\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

 > Executing task in folder Bee Hive Monitor: C:\Users\jcp\.platformio\penv\Scripts \platformio.exe run <

In src/ you have multiple sources files all wanting to define setup() and loop(). Remove all source files from src/ that you don’t want to compile.

Thanks Max
That works.
I have stuff in yellow as well see below.
Do I need to worry about it. It mostly seems to be related to the onewire library and OneWire.ccp. Do I delete that. I’m thinking I need that file for the library to work.

src\Temp Humidity and weight v1.cpp: In function 'String getSensorReadings()':
src\Temp Humidity and weight v1.cpp:57:1: warning: no return statement in function  returning non-void [-Wreturn-type]
 }
 ^
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp: In member function 'uint8_t    OneWire::reset()':
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp:167:24: warning: unused  variable 'reg' [-Wunused-variable]
  volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
                    ^
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp: In member function 'void  OneWire::write_bit(uint8_t)':
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp:201:24: warning: unused variable 'reg' [-Wunused-variable]
  volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;
                    ^
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp: In member function 'uint8_t  OneWire::read_bit()':
.pio\libdeps\esp32doit-devkit-v1\OneWire\OneWire.cpp:229:24: warning: unused  variable 'reg' [-Wunused-variable]
  volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg;

That warning is on you, in your getSensorReadings() function you do not return a String object, you just leave the function.

While these unused variable warnings can usually be ignored, it says at esp32 doesn't work · Issue #90 · PaulStoffregen/OneWire · GitHub that the library doesn’t reliably work with the ESP32. A PR is linked in there pointing to a fixed library, if you want to use that, use

lib_deps = 
   https://github.com/garyd9/OneWire/archive/refs/heads/ESP32-fixes.zip

in the platformio.ini instead of your old OneWire library directive.