4 years, 6 months ago.

undefined reference to BLE::onEventsToProcess

Hello I'm new with mbed os,

I'm trying to compile an existing project from Eclipse but I have the followings errors;

..\testProject\Default/../BLEmanager.cpp:19: undefined reference to `BLE::onEventsToProcess(FunctionPointerWithContext<BLE::OnEventsToProcessCallbackContext*> const&)'
..\testProject\Default/../BLEmanager.cpp:24: undefined reference to `BLE::gap()'
./BLEmanager.o: In function `BLEmanager::start(bool, char const*)':
..\testProject\Default/../BLEmanager.cpp:37: undefined reference to `BLE::gap()'
..\testProject\Default/../BLEmanager.cpp:37: undefined reference to `Gap::onDisconnection(FunctionPointerWithContext<Gap::DisconnectionCallbackParams_t const*>)'
..\testProject\Default/../BLEmanager.cpp:38: undefined reference to `BLE::gap()'
..\testProject\Default/../BLEmanager.cpp:38: undefined reference to `Gap::onConnection(FunctionPointerWithContext<Gap::ConnectionCallbackParams_t const*>)'
..\testProject\Default/../BLEmanager.cpp:39: undefined reference to `BLE::accumulateAdvertisingPayload(GapAdvertisingData::DataType_t, unsigned char const*, unsigned char)'
..\testProject\Default/../BLEmanager.cpp:40: undefined reference to `BLE::gap()'
..\testProject\Default/../BLEmanager.cpp:44: undefined reference to `BLE::gattServer()'
./BLEmanager.o: In function `BLEmanager::disconnect()':
..\testProject\Default/../CrayoscopeBLEManager.h:26: undefined reference to `events::EventQueue::~EventQueue()'
./CrayoscopeBLEManager.o: In function `BLECharacteristic<unsigned char, 20u>::set(unsigned char const (&) [20], bool) const':
..\testProject\Default/../BLECharacteristic.h:44: undefined reference to `BLE::gattServer()'
./CrayoscopeBLEManager.o: In function `BLECharacteristic<unsigned char, 1u>::set(unsigned char const (&) [1], bool) const':
..\testProject\Default/../BLECharacteristic.h:44: undefined reference to `BLE::gattServer()'
./main.o: In function `nrf_gpio_pin_port_decode':
..\mbed-os\targets\TARGET_NORDIC\TARGET_NRF5x\TARGET_SDK_14_2\drivers_nrf\hal/nrf_gpio.h:464: undefined reference to `assert_nrf_callback'
./main.o: In function `gpio_write':

It look like a linking error but I don't really understand the problem. The object file of my source are well generated. I already add all includes path in Eclipse Path and Symbol, so the compiler know the include path. I try to add the include path to the linker but that doesn't solved the problem. Here is the Eclipse generated Makefile:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := del

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(ASM_DEPS)),)
-include $(ASM_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: testProject

# Tool invocations
testProject: $(OBJS) $(USER_OBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: GNU ARM Cross C++ Linker'
	arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -O0  -g3 -Xlinker --gc-sections -L"..\testProject\Default" -L"..\testProject" -Wl,-Map,"testProject.map" -o "testProject" $(OBJS) $(USER_OBJS) $(LIBS)
	@echo 'Finished building target: $@'
	@echo ' '

# Other Targets
clean:
	-$(RM) $(CC_DEPS)$(C++_DEPS)$(OBJS)$(C_UPPER_DEPS)$(CXX_DEPS)$(ASM_DEPS)$(S_UPPER_DEPS)$(C_DEPS)$(CPP_DEPS) testProject
	-@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets

Thank you for your help.

Regards Alexandre

Hello Alexandre,

Quote:

I'm trying to compile an existing project from Eclipse ...

  • How did you get the Eclipse project? (Was it exported from the online compiler?)
  • What is the target board you are compiling for?
  • To avoid troubles with "Eclipse + Mbed" I'd recommend you to give the Mbed Studio IDE a try. It's a great tool to work offline with Mbed.
posted by Zoltan Hudak 22 Oct 2019

Hello Zoltan,

Quote:

How did you get the Eclipse project? (Was it exported from the online compiler?)

I'm working from an existing student project already under Eclipse.

Quote:

What is the target board you are compiling for?

nRF52-PCA10040

Quote:

To avoid troubles with "Eclipse + Mbed" I'd recommend you to give the Mbed Studio IDE a try. It's a great tool to work offline with Mbed.

I don't know why he starts with Eclipse, but it could still be interesting to understand the entire Mbed-os compilation process.

Regards Alexandre

posted by Alexandre Mendy 23 Oct 2019

1 Answer

4 years, 6 months ago.

Hello Alexandre,

Because to configure an Mbed project using Eclipse IDE could be quite troublesome (requires deeper knowledge of Mbed project structure) I'd suggest the following:

Accepted Answer

Thank you very much, I will try it today.

Regards Alexandre

posted by Alexandre Mendy 23 Oct 2019