Error message when compiling sketch

Good morning,

Trying to compile (Using IDE 2.2.1) a sketch into a NodeMCU-32S and I get the following error message(s).

In file included from c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEAdvertising.h:15,
from c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEServer.h:19,
from c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEDevice.h:18,
from C:\Users\Peter\Documents\Arduino\sketch_dec19a\sketch_dec19a.ino:1:
c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/FreeRTOS.h:61:28: error: 'ringbuf_type_t' has not been declared
Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
^~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

Can any help me resolve this

Many thanks

Peter

Not unless you post your sketch, using code tags when you do

see error: 'ringbuf_type_t' has not been declared · Issue #1100 · nkolban/esp32-snippets · GitHub

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>
String knownBLEAddresses[] = {"6E:bc:55:18:cf:7b", "53:3c:cb:56:36:02", "40:99:4b:75:7d:2f", "5c:5b:68:6f:34:96, a4:d4:b2:0e:27:da"};
int RSSI_THRESHOLD = -55;
bool device_found;
int scanTime = 5; //In seconds
BLEScan* pBLEScan;
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
    void onResult(BLEAdvertisedDevice advertisedDevice) {
      for (int i = 0; i < (sizeof(knownBLEAddresses) / sizeof(knownBLEAddresses[0])); i++)
      {
        //Uncomment to Enable Debug Information
        //Serial.println("*************Start**************");
        //Serial.println(sizeof(knownBLEAddresses));
        //Serial.println(sizeof(knownBLEAddresses[0]));
        //Serial.println(sizeof(knownBLEAddresses)/sizeof(knownBLEAddresses[0]));
        //Serial.println(advertisedDevice.getAddress().toString().c_str());
        //Serial.println(knownBLEAddresses[i].c_str());
        //Serial.println("*************End**************");
        if (strcmp(advertisedDevice.getAddress().toString().c_str(), knownBLEAddresses[i].c_str()) == 0)
                        {
          device_found = true;
                          break;
                        }
        else
          device_found = false;
      }
      Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str());
    }
};
void setup() {
  Serial.begin(115200); //Enable UART on ESP32
  Serial.println("Scanning..."); // Print Scanning
  pinMode(LED_BUILTIN, OUTPUT); //make BUILTIN_LED pin as output
  BLEDevice::init("");
  pBLEScan = BLEDevice::getScan(); //create new scan
  pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); //Init Callback Function
  pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
  pBLEScan->setInterval(100); // set Scan interval
  pBLEScan->setWindow(99);  // less or equal setInterval value
}
void loop() {
  // put your main code here, to run repeatedly:
  BLEScanResults foundDevices = pBLEScan->start(scanTime, false);
  for (int i = 0; i < foundDevices.getCount(); i++)
  {
    BLEAdvertisedDevice device = foundDevices.getDevice(i);
    int rssi = device.getRSSI();
    Serial.print("RSSI: ");
    Serial.println(rssi);
    if (rssi > RSSI_THRESHOLD && device_found == true)
      digitalWrite(LED_BUILTIN, HIGH);
    else
      digitalWrite(LED_BUILTIN, LOW);
  }
  pBLEScan->clearResults();   // delete results fromBLEScan buffer to release memory
}

Above is my code :slight_smile:

have you read the discussion in the link? One poster said

I deleted the ESP32_BLE_ARDUINO folder in the libraries and problem solved.

have you tried that?

Yep deleted that file. When recompiled I get the following error.

In file included from c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEAdvertising.h:15,
                 from c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEServer.h:19,
                 from c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEDevice.h:18,
                 from C:\Users\Peter\Documents\Arduino\sketch_dec19a\sketch_dec19a.ino:1:
c:\Users\Peter\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/FreeRTOS.h:61:28: error: 'ringbuf_type_t' has not been declared
  Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
                            ^~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

I don't have the issue

someone else said

I removed all libraries the ESP32 BLE. After that I install again board ESP32 and Didn't install the ESP32 BLE library. I uploaded the program server again and it worked.

probably look at conflicting files and includes

All relevent files deleted, now the error has changed to;

C:\Users\Peter\Documents\Arduino\sketch_dec19a\sketch_dec19a.ino:1:10: fatal error: BLEDevice.h: No such file or directory
#include <BLEDevice.h>
^~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: BLEDevice.h: No such file or directory

Hi @ttquattroman. Are you still experiencing this error? If yes, I'm going to ask you to post the full verbose output from a compilation.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to "Show verbose output during: ☐ compilation" in the "Preferences" dialog.
  3. Click the "OK" button.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to fail.
  6. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  7. Open a forum reply here by clicking the "Reply" button.
  8. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block icon on toolbar
  9. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the compilation output into the code block.
  10. Move the cursor outside of the code block markup before you add any additional text to your reply.
  11. Click the "Reply" button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:
    Upload icon on toolbar
    A dialog will open.
  6. In the dialog, select the .txt file you saved.
  7. Click the "Open" button.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

Sorry I have reverted to an earlier version of IDE and change the sketch. Now have new question which I will post under a seperate topic.

Thanks

Peter

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.