Xtensa/hal.h Arduino.h error

Hi, I’m having a challenge where I get this error when I open my main.cpp
I have installed Arduino extensions

cannot open source file "xtensa/hal.h" (dependency of "Arduino.h")
#include "Arduino.h"
#include "BleScanner.h"
#include "EnOceanBLEScannerSubscriber.h"
#include "PTM215/PTM215EventAdapter.h"
#include "EnOceanUtils.h"
#include "Wifi.h"

const char* ssid = "IOT";
const char* pass = "iot4ever";

void: setupWifi(){
  delay(100);
  Serial.print("\nConnecting to");
  Serial.println(ssid);

  Wifi.begin(ssid, pass);

  while(wifi.status() != WL_CONNECTED){
    delay[100];
    serial.print("-");

  }
  Serial.print("\nConnected to");
  Serial.println(ssid);
}
// Fill in PTM215 address and security key
#define PTM_BLE_ADDRESS1 "E2:15:00:04:C8:0B"
#define PTM_SECURITY_KEY1 "17B7BE15187DBF493ADD6E77A767E376"
#define PTM_DEVICE_REFERENCE_ID1 77 // Id available in eventhandler when receiving events 

#define PTM_BLE_ADDRESS2 "XX:XX:XX:XX:XX:XX"
#define PTM_SECURITY_KEY2 "????????????????????????????????"
#define PTM_DEVICE_REFERENCE_ID2 88 // Id available in eventhandler when receiving events

#define PTMHANDLER_NODE_ID 23

// Class derived from PTM215EventHandler that will receive PTM215 events through BLEScanner and BLScannerSubscriber
class PTMHandler : public EnOcean::PTM215EventHandler {
  public:
    PTMHandler(const uint8_t id) : EnOcean::PTM215EventHandler(id) {};
    virtual ~PTMHandler() {};

    void handleEvent(const EnOcean::PTM215Event& event) override {
      log_i("Handling PTM Event by handler-node %d", getId());
      log_i("DeviceAddress: %s", event.device->address.toString().c_str());
      log_i("Event: ReferenceId: %d button %d type %d", event.referenceId, event.button, event.eventType);
    }
};

// Generic BLEScanner listening for advertisements.
BleScanner::Scanner scanner;
EnOcean::BLEScannerSubscriber scannerSubscriber;

PTMHandler* ptmHandler;

void setup() {
  Serial.begin(115200);
  setupwifi();

  log_i("Starting EnOcean BLE Example HandleEventsMultiplePTM215...");

  ptmHandler = new PTMHandler(PTMHANDLER_NODE_ID);

  scanner.setScanDuration(1);

  // On receiving an advertisement, scannerSubscriber::onResult() will be called, which will call the handleEvent methods of all registered devices
  scanner.subscribe(&scannerSubscriber);

  NimBLEDevice::init("ESP32_client");

  scanner.initialize();

  log_d("Adding devices");
  // register handler for A0 and B0 buttons using pointer to handler
  scannerSubscriber.registerPTM215Device(PTM_BLE_ADDRESS1, PTM_SECURITY_KEY1, ptmHandler, true, false, true, false, PTM_DEVICE_REFERENCE_ID1);
  // register handler for A1, B0 and B1 buttons, using nodeId of handler
  scannerSubscriber.registerPTM215Device(PTM_BLE_ADDRESS2, PTM_SECURITY_KEY2, PTMHANDLER_NODE_ID, false, true, true, true, PTM_DEVICE_REFERENCE_ID2);

  log_i("Initialization done");
  log_i("===========================================");

}

void loop() {
  scanner.update();
  delay(1000);
}

…So, not the PlatformIO extension? Microsoft’s Arduino extension is separate from PlatformIO and many people don’t recommend to use it.

I have installed this, can´t find any other

I also installed this

But is your project a PlatformIO project?

I think
it is this project

Yes, it’s a PlatformIO project. You should uninstall the “Arduino” extension.