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

changing whitespace in code is causing compile error

when a particular line of my code is at line 54, the following compile error occurs: error: #101: "assert_line_54" has already been declared in the current scope

line 54 is where the error is occurring according to the compiler - it's a declaration of a variable to contain ESB payload data: nrf_esb_payload_t tx_payload = NRF_ESB_CREATE_PAYLOAD(0, 0x00, 0x00);

Adding or removing a line of whitespace before line 54 removes the compile error, and so does removing the NRF_ESB_CREATE_PAYLOAD, but I have no way of knowing whether this is due to a compiler bug or that there is an actual error in the code that is escaping detection. Why is this error occurring? NRF_ESB_CREATE_PAYLOAD makes use of STATIC ASSERT in esb.h, making use of static_assert_ or assert_line in app_util.h depending on whether COUNTER is defined in the SDK files. Keil reports static_assert- and assert_line are undefined, which I doubt however this means the trail ends there.

I include the standalone project folder where this can be reproduced: open standalone_project\projects\esbRX_SPIS\project\pca10040\arm5_no_packs\project_pca10040.uvprojx . I have removed all functions save for an empty main(). If the aforementioned line is at line 54, the error occurs, but not on any other line as far as I can tell.

Attachment: standalone_project.zip

Related