"Compilation error: exit status 1" problem

So my code kept saying that it has error "exit status 1
Compilation error: exit status 1"
here's my code :slight_smile:

#include <Arduino.h>
#include <SPI.h>
#include <RadioLib.h>      // RadioLib CC1101 driver
#include <NimBLEDevice.h>  // NimBLE for BLE peripheral

// ---------- HW pin definitions (ปรับได้ตามบอร์ดจริง) ----------
#define PIN_SPI_CS 10  // CS for CC1101
#define PIN_GDO0 3     // GDO0 from CC1101 -> IRQ
#define PIN_ADC 0      // ADC1_CH0 (GPIO0) -> MPX5700AP output

// ---------- CC1101 (RadioLib) object ----------
SX1278 rfModule;  // placeholder to avoid compile error if SX1278 referenced; we will create CC1101 below
// RadioLib has a CC1101 class named "CC1101" or "CC1101" depending on version.
// If your RadioLib version exposes CC1101 as "CC1101", use that class instead:
CC1101 cc1101(PIN_SPI_CS, PIN_GDO0);  // CS, GDO0

// ---------- BLE definitions ----------
#define BLE_DEVICE_NAME "ESP32-C3-Tire"
#define BLE_SERVICE_UUID "12345678-1234-1234-1234-1234567890ab"
#define BLE_CHAR_PRESSURE_UUID "abcd1234-5678-90ab-cdef-1234567890ab"

NimBLEServer* pServer = nullptr;
NimBLECharacteristic* pPressureChar = nullptr;
bool deviceConnected = false;

class ServerCallbacks : public NimBLEServerCallbacks
{
    void onConnect(NimBLEServer* pServer)
    {
        deviceConnected = true;
    }
    void onDisconnect(NimBLEServer* pServer)
    {
        deviceConnected = false;
    }
};

// ---------- helper: read MPX5700AP via ADC ----------
float readPressure_kPa()
{
    // MPX5700AP: output ~ Vout = Vs * (0.2 * (P/700) + offset) depending on wiring.
    // This function returns raw voltage and user converts to kPa based on sensor wiring/calibration.
    const float ADC_REF = 3.3f;  // ADC reference (V)
    const int ADC_MAX = 4095;    // 12-bit ADC
    int raw = analogRead(PIN_ADC);
    float voltage = (raw * ADC_REF) / ADC_MAX;
    // User must convert voltage -> pressure using sensor transfer function and supply voltage.
    // Example placeholder conversion (ADJUST with calibration):
    // MPX5700AP typical sensitivity ~ 26.6 mV/kPa at Vs=10V ; if using supply and amplifier different, calibrate.
    float pressure_kPa = voltage;  // placeholder, return voltage for now
    return pressure_kPa;
}

// ---------- CC1101 receive callback via interrupt ----------
volatile bool cc1101PacketReady = false;

void IRAM_ATTR cc1101ISR()
{
    cc1101PacketReady = true;
}

void setupCC1101()
{
    // initialize SPI if necessary (RadioLib handles SPI)
    SPI.begin();  // use default pins mapped earlier; adjust if needed

    // Initialize CC1101
    int state = cc1101.begin();
    if (state != RADIOLIB_ERR_NONE)
    {
        // init failed, blink LED or serial error
        Serial.print("CC1101 init failed, code: ");
        Serial.println(state);
        // don't halt; continue to allow BLE for debugging
    }
    else
    {
        Serial.println("CC1101 init OK");
    }

    // Example configuration: set frequency, modulation, datarate
    // Adjust parameters to match transmitter
    cc1101.setFrequency(433.92);  // MHz, change to 868 or 915 as needed
    cc1101.setBitRate(4800);      // bps
    cc1101.setModulation(2);      // 2 = GFSK in some RadioLib versions; check docs
    cc1101.setOutputPower(8);     // dBm, adjust

    // attach interrupt on GDO0 for packet received (falling/rising depends on GDO mapping)
    pinMode(PIN_GDO0, INPUT);
    attachInterrupt(digitalPinToInterrupt(PIN_GDO0), cc1101ISR, RISING);

    // Put CC1101 in RX mode
    cc1101.receive();
}

void setupBLE()
{
    NimBLEDevice::init(BLE_DEVICE_NAME);
    pServer = NimBLEDevice::createServer();
    pServer->setCallbacks(new ServerCallbacks());

    NimBLEService* pService = pServer->createService(BLE_SERVICE_UUID);
    pPressureChar = pService->createCharacteristic(
      BLE_CHAR_PRESSURE_UUID,
      NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY);
    pPressureChar->setValue("0.00");
    pService->start();

    NimBLEAdvertising* pAdv = NimBLEDevice::getAdvertising();
    pAdv->addServiceUUID(BLE_SERVICE_UUID);
    pAdv->start();
    Serial.println("BLE advertising started");
}

void setup()
{
    Serial.begin(115200);
    delay(100);

    // ADC config
    analogReadResolution(12);  // 12-bit ADC (0-4095)
    // Optionally set attenuation depending on expected voltage
    analogSetPinAttenuation(PIN_ADC, ADC_11db);  // supports up to ~3.3V reading better

    setupBLE();
    setupCC1101();

    Serial.println("Setup complete");
}
void loop()
{
    // Periodically read sensor and send BLE notify
    static unsigned long lastSensorMs = 0;
    const unsigned long SENSOR_INTERVAL = 5000;  // ms

    if (millis() - lastSensorMs >= SENSOR_INTERVAL)
    {
        lastSensorMs = millis();
        float p = readPressure_kPa();  // placeholder: returns voltage; calibrate to kPa
        char buf[32];
        // format as string (pressure or voltage)
        snprintf(buf, sizeof(buf), "%.3f", p);
        pPressureChar->setValue(buf);
        if (deviceConnected)
        {
            pPressureChar->notify();  // send notify to connected device
        }
        Serial.print("Sensor: ");
        Serial.println(buf);
    }

    // Handle CC1101 received packet
    if (cc1101PacketReady)
    {
        cc1101PacketReady = false;
        // read raw packet
        String rcv;
        int state = cc1101.readData(rcv);  // RadioLib readData overload returns string
        if (state == RADIOLIB_ERR_NONE)
        {
            Serial.print("RF RX: ");
            Serial.println(rcv);
            // optionally parse payload, e.g., "ID:123;P:45.6"
            // and forward via BLE characteristic or update state
            // Example: send received payload as BLE notify as well
            if (deviceConnected)
            {
                pPressureChar->setValue(rcv.c_str());
                pPressureChar->notify();
            }
        }
        else if (state == RADIOLIB_ERR_RX_TIMEOUT)
        {
            // no data
        }
        else
        {
            Serial.print("CC1101 read error: ");
            Serial.println(state);
        }

        // re-enter receive mode
        cc1101.receive();
    }

    // NimBLE background processing
    NimBLEDevice::run();
}

I tried some ways that claimed to fix the problem but that never work like I try adding void 'setup () {
}'
but it doesn't work

Welcome to the forum

Thank you for trying to use code tags but you got it wrong. I have corrected it

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

It is also helpful to post full error messages in code tags as it makes it easier to scroll through them and copy them for examination

Please post the full error message, using code tags when you do

which specific ESP32 are you using? e.g. ESP32, ESP32S3, ESP32C3, etc
which ESP32 core are you using?
have you tested the SX1278 module using RadioLib's example code? e.g. File>Examples>RadioLib>SX127X/SX127x_Receive_Interrupt?
have you tested the NimBLEDevice library in a separate program?
post a schematic?

I use ESP32-C3 and no i don't have any of that device you named

have you tested the CC1101 module using RadioLib's example code?
e.g. using Arduino IDE 2.3.4 and ESP32 core 3.3.2 File>Examples>RadioLib>CC1101>CC1101_Transmit_Interrupt compiles and links OK

why have you got the statement

SX1278 rfModule;  // placeholder to avoid compile error if SX1278 referenced; we will create CC1101 below

if you are not using a SX1278 module?

if I include the statement in the sample code File>Examples>RadioLib>CC1101>CC1101_Transmit_Interrupt
I get a compile time error

C:\Users\xx\AppData\Local\Temp\.arduinoIDE-unsaved2025918-16416-t97rwd.e80z\CC1101_Transmit_Interrupt\CC1101_Transmit_Interrupt.ino:20:8: error: no matching function for call to 'SX1278::SX1278()'
   20 | SX1278 rfModule;  // placeholder to avoid compile error if SX1278 referenced; we will create CC1101 below
      |        ^~~~~~~~
.....
Using library RadioLib at version 7.3.0 in folder: C:\Users\xx\Documents\Arduino\libraries\RadioLib 
Using library SPI at version 3.3.2 in folder: C:\Users\xx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\SPI 
exit status 1

remove the statement?

exit status 1

Compilation error: exit status 1

This error message is not full.
You likely have disabled verbose error messages in your Arduino IDE settings.
Open Preferences window and check two boxes: verbose output during compilation and verbose output during upload.
Then run the compilation again and upload the output here, using the code tags.

even with verbose disabled I get the following

C:\Users\XX\Documents\Arduino\CC1101_Transmit_Interrupt\CC1101_Transmit_Interrupt.ino:20:8: error: no matching function for call to 'SX1278::SX1278()'
   20 | SX1278 rfModule;  // placeholder to avoid compile error if SX1278 referenced; we will create CC1101 below
      |        ^~~~~~~~
In file included from c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/modules/SX127x/SX1276.h:8,
                 from c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/RadioLib.h:96,
                 from C:\Users\XX\Documents\Arduino\CC1101_Transmit_Interrupt\CC1101_Transmit_Interrupt.ino:19:
c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/modules/SX127x/SX1278.h:115:5: note: candidate: 'SX1278::SX1278(Module*)'
  115 |     SX1278(Module* mod); // cppcheck-suppress noExplicitConstructor
      |     ^~~~~~
c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/modules/SX127x/SX1278.h:115:5: note:   candidate expects 1 argument, 0 provided
c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/modules/SX127x/SX1278.h:106:7: note: candidate: 'constexpr SX1278::SX1278(const SX1278&)'
  106 | class SX1278: public SX127x {
      |       ^~~~~~
c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/modules/SX127x/SX1278.h:106:7: note:   candidate expects 1 argument, 0 provided
c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/modules/SX127x/SX1278.h:106:7: note: candidate: 'constexpr SX1278::SX1278(SX1278&&)'
c:\Users\XX\Documents\Arduino\libraries\RadioLib\src/modules/SX127x/SX1278.h:106:7: note:   candidate expects 1 argument, 0 provided

exit status 1

Compilation error: no matching function for call to 'SX1278::SX1278()'

the last line states what the problem is

Hi my name is Yousef am form Qatar

i have the same problem .(compilation error exit status 1.i found the solution

go to main menu choose the help then choose check for Arduino IDE updates

thanks

While installing updates is generally useful, it has nothing to do with the issue and is not a solution.

Message compilation error exit status 1 is not a real error message. It is just a status of the Arduino IDE that informs you that the compilation process ends with errors.
To see error messages itself, you need to enable verbose output in IDE preferences.