5 years ago.

How to solve unexpected compilation error with Mbed Studio?

Compilation Error using Mbed Studio

Mbed Studio seems to be a really promising IDE and I decided to give it a try. After installing it, I downloaded the example applications to compile them, but none of the compilations was successful. When compiling the BLE library/GenericGap.cpp file, an error arises each time.

I use a Nordic nRF51-DK and the issue seems to be linked to this board, because - being curious - I tried to compile the applications with other targets, and then I got 0 errors.

Thank you in advance for your answer.

Sincerely, Ervin

Output

Building project mbed-os-example-blinky (NRF51_DK, ARMC6)
Scan: mbed-os-example-blinky
Compile [  0.3%]: mbed_tz_context.c
Compile [  0.4%]: mbed_fault_handler.c
Compile [  0.5%]: MCR20Drv.c
Compile [  0.6%]: at24mac.cpp
Compile [  0.8%]: main.cpp
Compile [  0.9%]: NanostackRfPhyAtmel.cpp
Compile [  1.0%]: rf_configuration.c
Compile [  1.2%]: NanostackRfPhyMcr20a.cpp
Compile [  1.3%]: NanostackRfPhys2lp.cpp
Compile [  1.4%]: ESP8266Interface.cpp
Compile [  1.6%]: AnalogIn.cpp
Compile [  1.7%]: ESP8266.cpp
Compile [  1.8%]: BusIn.cpp
Compile [  1.9%]: BusInOut.cpp
Compile [  2.1%]: BusOut.cpp
Compile [  2.2%]: CAN.cpp
Compile [  2.3%]: Ethernet.cpp
Compile [  2.5%]: I2CSlave.cpp
Compile [  2.6%]: I2C.cpp
Compile [  2.7%]: InterruptIn.cpp
Compile [  2.9%]: FlashIAP.cpp
Compile [  3.0%]: InterruptManager.cpp
Compile [  3.1%]: MbedCRC.cpp
Compile [  3.2%]: QSPI.cpp
Compile [  3.4%]: RawSerial.cpp
Compile [  3.5%]: SPISlave.cpp
Compile [  3.6%]: SPI.cpp
Compile [  3.8%]: TableCRC.cpp
Compile [  3.9%]: Serial.cpp
Compile [  4.0%]: SerialBase.cpp
Compile [  4.2%]: Ticker.cpp
Compile [  4.3%]: Timeout.cpp
Compile [  4.4%]: Timer.cpp
Compile [  4.5%]: TimerEvent.cpp
Compile [  4.7%]: equeue.c
Compile [  4.8%]: EventQueue.cpp
Compile [  4.9%]: equeue_posix.c
Compile [  5.1%]: UARTSerial.cpp
Compile [  5.2%]: equeue_mbed.cpp
Compile [  5.3%]: mbed_shared_queues.cpp
Compile [  5.5%]: BLEInstanceBase.cpp
Compile [  5.6%]: DiscoveredCharacteristic.cpp
Compile [  5.7%]: BLE.cpp
Compile [  5.8%]: GapScanningParams.cpp
Compile [  6.0%]: AdvertisingParameters.cpp
Compile [  6.1%]: AdvertisingDataBuilder.cpp
Compile [  6.2%]: LegacyGap.cpp
Compile [  6.4%]: ConnectionParameters.cpp
Compile [  6.5%]: Gap.cpp
Compile [  6.6%]: FileSecurityDb.cpp
Compile [  6.8%]: GenericGap.cpp
[ERROR] .\mbed-os\features\FEATURE_BLE\source\generic\GenericGap.cpp:853:40: error: invalid operands to binary expression ('ble::pal::hci_error_code_t::type' and 'pal::hci_error_code_t')
if (pal::hci_error_code_t::SUCCESS != hci_status) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~
.\mbed-os\features\FEATURE_BLE\ble/ArrayView.h:316:6: note: candidate template ignored: could not match 'ArrayView<type-parameter-0-0, Size>' against 'ble::pal::hci_error_code_t::type'
bool operator!=(const ArrayView<T, LhsSize>& lhs, const ArrayView<T, LhsSize>& rhs)
^
.\mbed-os\features\FEATURE_BLE\ble/common/Duration.h:462:6: note: candidate template ignored: could not match 'Duration<type-parameter-0-0, TB, type-parameter-0-2, type-parameter-0-3>' against 'ble::pal::hci_error_code_t::type'
bool operator!=(
^
.\mbed-os\features\FEATURE_BLE\ble/common/Duration.h:479:6: note: candidate template ignored: could not match 'Duration<type-parameter-0-0, TB, type-parameter-0-2, type-parameter-0-3>' against 'ble::pal::hci_error_code_t::type'
bool operator!=(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs)
^
.\mbed-os\features\FEATURE_BLE\source\generic\GenericGap.cpp:870:40: error: invalid operands to binary expression ('ble::pal::hci_error_code_t::type' and 'pal::hci_error_code_t')
if (pal::hci_error_code_t::SUCCESS != hci_status) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~
.\mbed-os\features\FEATURE_BLE\ble/ArrayView.h:316:6: note: candidate template ignored: could not match 'ArrayView<type-parameter-0-0, Size>' against 'ble::pal::hci_error_code_t::type'
bool operator!=(const ArrayView<T, LhsSize>& lhs, const ArrayView<T, LhsSize>& rhs)
^
.\mbed-os\features\FEATURE_BLE\ble/common/Duration.h:462:6: note: candidate template ignored: could not match 'Duration<type-parameter-0-0, TB, type-parameter-0-2, type-parameter-0-3>' against 'ble::pal::hci_error_code_t::type'
bool operator!=(
^
.\mbed-os\features\FEATURE_BLE\ble/common/Duration.h:479:6: note: candidate template ignored: could not match 'Duration<type-parameter-0-0, TB, type-parameter-0-2, type-parameter-0-3>' against 'ble::pal::hci_error_code_t::type'
bool operator!=(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs)
^
2 errors generated.

1 Answer

4 years, 10 months ago.

Hi Racz,

What version of Mbed OS are you using in your program? Can you update it to 5.12.0 or higher and try again?

- Arek Zaluski