Chrono file note found: Fatal Error

Hi
I am seeing a strange issue here with compilation

Working scenario
main.cpp
#include “mbed.h”
#include “psa/crypto.h”
etc
i am able to correctly call all the psa functions ( i have the necessary macros enabled for my target)

Failing Scenario
i move all the cypto functionalities and calls to a separate file - say cryptofunctions.h/.c
Include it in main.cpp

During compilation, i get following error

[Fatal Error] Kernel.h@27,10: ‘chrono’ file not found
[ERROR] In file included from .\cryptofunctions.c:2:
In file included from ./mbed-os\mbed.h:22:
In file included from ./mbed-os/rtos/include\rtos/rtos.h:28:
./mbed-os/rtos/include\rtos/Kernel.h:27:10: fatal error: ‘chrono’ file not found
#include
^~~~~~~~
1 error generated.


What is this error and how to address it?
my target is PSoC6 WIFI BT Kit

I fixed this by including the stdlib file

Thank you

Add stdlib.h where? I have added it in numerous places with no effect.

mbed os’s .c source files should not include mbed.h. Check if one of your own header file duplicates the name of a mbed os header file, making the compiler incorrectly includes your header file instead of the mbed os one.

1 Like

@Xu_Wang 's solution worked for me, I was having the same problem. I turned out to have in my project a file named device.cpp and a file named device.h. Somehow in the chain of #includes, my device.h file was being included in the compilation of the kernel. Renaming my file solved the problem.