4 years ago.

Can't find mbed.h when I compiled with GCC in Keil uVision5

Hello

I extracted project file from mbed platform. It is for offline debugging of over-sized(32k) source code. When I built the file, I faced to these errors.

it says lack of mbed.h, but there is actually the header file in the mbed folder. I got same error when I C&P the header file at same directory of x_nucleo_iks01a1.cpp.

does anyone know how to deal with this??

compilerErrorMessage

compiling x_nucleo_iks01a1.cpp...
X_NUCLEO_IKS01A1/mbed.h(29): error: fatal error: toolchain.h: No such file or directory
compiling hts221_class.cpp...
X_NUCLEO_IKS01A1/Components/hts221/hts221_class.h(42): error: fatal error: mbed.h: No such file or directory
compiling main.cpp...
main.cpp(18): error: fatal error: mbed.h: No such file or directory
compiling lis3mdl_class.cpp...
X_NUCLEO_IKS01A1/Components/lis3mdl/lis3mdl_class.h(42): error: fatal error: mbed.h: No such file or directory
compiling lsm6ds0_class.cpp...
X_NUCLEO_IKS01A1/Components/lsm6ds0/lsm6ds0_class.h(42): error: fatal error: mbed.h: No such file or directory
compiling lps25h_class.cpp...
X_NUCLEO_IKS01A1/Components/lps25h/lps25h_class.h(42): error: fatal error: mbed.h: No such file or directory
compiling lsm6ds3_class.cpp...
X_NUCLEO_IKS01A1/Components/lsm6ds3/lsm6ds3_class.h(42): error: fatal error: mbed.h: No such file or directory

Marchall

Hi Marchall,

Did you export to uVision or GCC?

posted by Andrea Corrado 05 Sep 2016

Hi Andrea, I exported the project to uVision4. Also tried uVision5.

posted by Marchall Oakbow 05 Sep 2016

I downloaded the other project, led_blink, and it also said "mbed.h: No such file or directory"

posted by Marchall Oakbow 05 Sep 2016

The header file problem is solved. I have forgot to edit the include path. But the next is the compiler doesnt recognize class objects and linking process. Is this because of "C" compiler? Does it compile C++ code includes class or moreover??

posted by Marchall Oakbow 06 Sep 2016

Hi Marchall,

Are you using mbed-os?

posted by Andrea Corrado 09 Sep 2016

Hi Andrea

I don't use mbed-os

posted by Marchall Oakbow 09 Sep 2016

Marchall,

Can you send the program you are trying to export to uVision?

posted by Andrea Corrado 09 Sep 2016

This is the test code I tried compiling

  1. include "mbed.h"

DigitalOut myled(LED1);

int main() { while(1) { myled =! myled; LED is ON wait(1); } }

posted by Marchall Oakbow 09 Sep 2016

Once after start building the project, The uVision IDE went freeze and a window appeared to say "ld.exe has stopped"

posted by Marchall Oakbow 09 Sep 2016

The original code I pasted at first is kinda heavy, so I am trying to compile simple project with GCC in Keil.

posted by Marchall Oakbow 09 Sep 2016

Though it is too long, but I put the error message I got when I compiled the test code.

Rebuild target 'Nucleo_blink_led' compiling main.cpp... linking... c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: error: mbed/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/cmsis_nvic.o uses VFP register arguments, ./Nucleo_blink_led.elf does not c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file mbed/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/cmsis_nvic.o c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: error: mbed/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/hal_tick.o uses VFP register arguments, ./Nucleo_blink_led.elf does not c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file mbed/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/hal_tick.o c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: error: mbed/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/system_stm32f4xx.o uses VFP register arguments, ./Nucleo_blink_led.elf does not c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file mbed/TARGET_NUCLEO_F401RE/TOOLCHAIN_ARM_STD/system_stm32f4xx.o collect2.exe: error: ld returned 255 exit status ".\Nucleo_blink_led.elf" - 1 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:30

posted by Marchall Oakbow 09 Sep 2016

After reading these error messages, the GCC Linker doesnt work because it lacks of .lib files or something else?? Maybe the ones exported as gcc have.

posted by Marchall Oakbow 09 Sep 2016
Be the first to answer this question.