Skip to content

CW Troubleshooting Guide

jaenrig-ifx edited this page Aug 4, 2020 · 2 revisions

Troubleshooting for C++ Builds

The following changes are requires for a error free build when using the Hall Switch library. Other errors might appear as different SDK components and sources are included. These are only the oned experienced during the integration of the Hall Switch library.

Issue with C++ Include Guards

The WICED Studio (version 6.4.0) toolchain support C and C++ language. The Hall Switch library is written in C++.

Nevertheless, some of the guards braces to include C in C++ such

#ifdef _cplusplus 
extern "C" { 
#endif

are not closed, leading to compilation error.

Quick Workaround

As a quick a workaround, in the main progam entry point after the application_start( ){} block add an additional "}" closing brace.

In the provided app example hall_switch.cpp file:

...

void application_start( )
{
    wiced_result_t      result;

    /* Initialize the device */
    result = wiced_init();
    if (result != WICED_SUCCESS)
    {
        return;
    }

    ... //Main application
}

//} /**< Uncomment for WICED missing _cplusplus guards workaround */

Even confusing and not elegant it will do the work.

Known Files Requiring Closing "}"

The proper long term solution is to fix those files with unclosed blocks. The following files (in version 6.4.0) have been found with this issue:

  • apps/snip/bluetooth/simple_ble_peripheral/ble_event_map.h
  • apps/snip/bluetooth/simple_ble_peripheral/simple_ble_peri.h
  • WICED/platform/ARM_CR4/platform_checkpoint.h
  • WICED/platform/security/BESL/mbedtls_open/include/mbedtls/md5_alt.h

Add the following to the bottom of the file:

#ifdef __cplusplus
} /* extern "C" */
#endif

MQTT Module Reserved C++ Keywords

When including the MQTT module additional compilation errors appear. The keyword new is reserved in C++. In the file libraries/protocols/MQTT/mqtt_linked_list.h substitute it for a non-reseved one, as i.e. newe. Also NULL needs to be rewritten as (void *) 0. Check the modifications here: