I facing the above issue when build a project. The project structure is below. I copied the Git project project to d:can/firmware/zephyr/samples/drivers/can from https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/shields/mcp2515. When build either in VSC or SES using NCS v1.9.1 as SDK and Toolchain path, above issue appears.
Then, I copied the same Git project project to c:/ncs/v1.9.1/zephyr/samples/drivers/can. (There was already a can folder in the same directory, so first rename default can as can_1.9.1, then copied Git can)
I tried to build this project also in SES and VSC, but same issue. I checked zephyr folder/ subfolders, the kernel.h exists in the folder which outside the project folder.
The path of kernel.h is .../Zephyr/include/...
I tried to include using CMake command : target_include_directories(app PUBLIC ${can/firmware/zephyr/include})
#target_link_libraries(app PUBLIC ${can/firmware/zephyr/include}),
but these didn't work
