Eliot Eliot - 1 year ago 183
C Question

Eclipse CDT error: "Symbol 'XXX' could not be resolved"

I have an embedded C project that builds and runs just fine using make on the console, but Eclipse CDT is giving me errors.

In main.c, this function uses a macro, APP_BUTTON_INIT:

static void buttons_init(void)
static app_button_cfg_t buttons[] =
{SIGNAL_ALERT_BUTTON, false, NRF_GPIO_PIN_NOPULL, button_event_handler},

APP_BUTTON_INIT(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY, false);

The APP_BUTTON_INIT macro is defined in app_button.h like this:

do \
{ \
uint32_t ERR_CODE = app_button_init((BUTTONS), \
(USE_SCHEDULER) ? app_button_evt_schedule : NULL); \
} while (0)

The error is

Symbol 'app_button_evt_schedule' could not be resolved

But that function is defined further down in the very same header file, app_button.h:

static __INLINE uint32_t app_button_evt_schedule(app_button_handler_t button_handler,
uint8_t pin_no)
app_button_event_t buttons_event;

buttons_event.button_handler = button_handler;
buttons_event.pin_no = pin_no;

return app_sched_event_put(&buttons_event, sizeof(buttons_event), app_button_evt_get);

I've tried Project right click -> Index -> Rebuild and Freshen all files, no joy. I'm using Eclipse Kepler SR1 with CDT 8.2.1. Why can't Eclipse see this function?

The first operation of the makefile is this (this works):

mkdir _build
"/Users/Eliot/dev/gcc-arm/bin/arm-none-eabi-gcc" -DNRF51822_QFAA_CA -mcpu=cortex-m0 -mthumb -mabi=aapcs -DNRF51 -DBOARD_NRF6310 -DNRF51822_QFAA_CA --std=gnu99 -Wall -Werror -mfloat-abi=soft -DDEBUG -g3 -O0 -I"/Users/Eliot/dev/nrf51822/Include/ble" -I"/Users/Eliot/dev/nrf51822/Include/ble/softdevice" -I"/Users/Eliot/dev/nrf51822/Include/app_common" -I"/Users/Eliot/dev/nrf51822/Include/ble/ble_services" -I"../" -I"/Users/Eliot/dev/nrf51822/Include" -I"/Users/Eliot/dev/nrf51822/Include/gcc" -I"/Users/Eliot/dev/nrf51822/Include/ext_sensors" -M ../main.c -MF "_build/main.d" -MT _build/main.o

Screenshots for my CDT project config for includes, symbols and the tool chain are here:


I'm not using a toolchain because my project started out as the sample CDT project from the hardware manufacturer (Nordic Semiconductor) and that project also had no toolchain configured. To be honest, I doubt CDT is finding the right gcc executable.

Answer Source

Self-answering. Running around without a proper toolchain configured in Eclipse was the problem. For ARM development using cross gcc, this Eclipse plugin fixed my problem and looks promising in general. It gives you Eclipse project settings for the whole toolchain and means you can ditch your makefiles.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download