This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

C++ compilation error with SDK 12.1.0 and 12.0.0: error: expected declaration before '}' token

Getting the error when trying to compile the C++ project with SDK 12.1.0:

In file included from .../components/softdevice/common/softdevice_handler/softdevice_handler.h:41:0,
                 from main.cpp:11:
.../components/softdevice/common/softdevice_handler/ant_stack_handler_types.h:78:1: error: expected declaration before '}' token
 }
 ^

The same with SDK 12.0.0.

Parents
  • Here is the patch:

    diff -rcN nRF5-SDK-12.1.0/components/proprietary_rf/gzll/nrf_gzll_error.h nRF5-SDK-12.1.0-fix/components/proprietary_rf/gzll/nrf_gzll_error.h
    *** nRF5-SDK-12.1.0/components/proprietary_rf/gzll/nrf_gzll_error.h	2016-10-04 14:09:12.000000000 +0300
    --- nRF5-SDK-12.1.0-fix/components/proprietary_rf/gzll/nrf_gzll_error.h	2016-11-03 01:06:19.489624670 +0300
    ***************
    *** 22,27 ****
    --- 22,31 ----
      #include "nrf_gzll.h"
      #include "app_error.h"
      
    + #ifdef __cplusplus
    + extern "C" {
    + #endif
    + 
      #define GAZELLE_ERROR_CODE_CHECK(GZLL_RESULT)                                       \
          do                                                                              \
          {                                                                               \
    diff -rcN nRF5-SDK-12.1.0/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h nRF5-SDK-12.1.0-fix/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h
    *** nRF5-SDK-12.1.0/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h	2016-10-04 14:09:12.000000000 +0300
    --- nRF5-SDK-12.1.0-fix/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h	2016-11-03 01:18:58.564026665 +0300
    ***************
    *** 65,70 ****
    --- 65,74 ----
       */
      uint32_t softdevice_ant_evt_handler_set(ant_evt_handler_t ant_evt_handler);
      
    + #ifdef __cplusplus
    + }
    + #endif
    + 
      #else
      
      // The ANT Stack support is not required.
    ***************
    *** 73,83 ****
      
      #endif // ANT_STACK_SUPPORT_REQD
      
    - 
    - #ifdef __cplusplus
    - }
    - #endif
    - 
      #endif // ANT_STACK_HANDLER_TYPES_H__
      
      /** @} */
    --- 77,82 ----
    
Reply
  • Here is the patch:

    diff -rcN nRF5-SDK-12.1.0/components/proprietary_rf/gzll/nrf_gzll_error.h nRF5-SDK-12.1.0-fix/components/proprietary_rf/gzll/nrf_gzll_error.h
    *** nRF5-SDK-12.1.0/components/proprietary_rf/gzll/nrf_gzll_error.h	2016-10-04 14:09:12.000000000 +0300
    --- nRF5-SDK-12.1.0-fix/components/proprietary_rf/gzll/nrf_gzll_error.h	2016-11-03 01:06:19.489624670 +0300
    ***************
    *** 22,27 ****
    --- 22,31 ----
      #include "nrf_gzll.h"
      #include "app_error.h"
      
    + #ifdef __cplusplus
    + extern "C" {
    + #endif
    + 
      #define GAZELLE_ERROR_CODE_CHECK(GZLL_RESULT)                                       \
          do                                                                              \
          {                                                                               \
    diff -rcN nRF5-SDK-12.1.0/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h nRF5-SDK-12.1.0-fix/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h
    *** nRF5-SDK-12.1.0/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h	2016-10-04 14:09:12.000000000 +0300
    --- nRF5-SDK-12.1.0-fix/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h	2016-11-03 01:18:58.564026665 +0300
    ***************
    *** 65,70 ****
    --- 65,74 ----
       */
      uint32_t softdevice_ant_evt_handler_set(ant_evt_handler_t ant_evt_handler);
      
    + #ifdef __cplusplus
    + }
    + #endif
    + 
      #else
      
      // The ANT Stack support is not required.
    ***************
    *** 73,83 ****
      
      #endif // ANT_STACK_SUPPORT_REQD
      
    - 
    - #ifdef __cplusplus
    - }
    - #endif
    - 
      #endif // ANT_STACK_HANDLER_TYPES_H__
      
      /** @} */
    --- 77,82 ----
    
Children
No Data
Related