3 years, 6 months ago.

uVision 5 - Serial "unknown type name 'Serial'"

Hey guys,

i tried to make my work trough the online compiler but its very strange after a few hours :D I installed mbed cli on my computer, imported my project and exported it for uVision. After starting it there are already 5 errors ... in my main program :D

  1. error in include chain (SDFileSystem.h): unknown type name 'SPI'
  2. error in include chain (ESP8266.h): unknown type name 'Serial'
  3. error: unknown type name 'Serial'
  4. same
  5. use of undeclared identifier 'Serial'

Online Compiler compiled it without errors.

On my "surface pro" there are no errors. i have got a fresh uVision.

Maybe someone knows a workaround

Ng Thomas

3 Answers

3 years, 6 months ago.

Those errors make me feel like the Mbed library is not in your project. Though, I don't think you would've been able to run export without it. Ccould you please send the latest commit hash inside your Mbed library? Please run "git log" inside Mbed and post the results. If you are using a public code repository, it would be helpful to know what it is. Then, I will try to replicate your issue.

I dont know how to use "git log" but i think you mean this -> 154:fb8e0ae1cceb?

I also tried to export just the blinky test program and insert Serial hmm(p9, p10, 115200); Same error.

Maybe my Keil has a wrong configuration?

posted by Thomas Jäger 01 Nov 2017

It looks like the export might be incomplete. I was not able to reproduce exporting mbed_blinky to uvision for k64f.

posted by Sarah Marsh 01 Nov 2017

Its for LPC1768. Maybe there is the problem?

posted by Thomas Jäger 01 Nov 2017
3 years, 5 months ago.

I am having same problem with this code https://github.com/Lora-net/picoGW_mcu Im using Nucleo-F401RE So I have tried to export standard UART example from mbed to keilv5. And even on this simplest sample keilv5 complains "unknown type name 'Serial'"


It does compile but serial does not work...


3 years, 5 months ago.


Provided that an mbed_config.h file was created by mbed when exporting the project from the online compiler, one solution/workaround is to add a new line #include "mbed_config.h" into the respective device.h file of your target board. It worked for me with the NUCLEO-F103RB board for Offline compilation and debugging with CooCox CoIDE.

For the LPC1768 board, when using MBED OS 2, the device.h file is located in the
mbed-dev\targets\TARGET_NXP\TARGET_LPC176X\TARGET_MBED_LPC1768 folder.

Now I do get some "fatal error in include chain" but no more red. Tnx

posted by Goran Mahovlic 27 Nov 2017