This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

keil compile error

hello: I open nrf51-ble-tutorial-service-master\SDK 11.0.0\nrf5-ble-tutorial-service\pca10040\s132\arm5_no_packs\ nrf52-ble-tutorial-service.uvprojx, and compile ,the result is :

compiling main.c... ......\main.c(31): error: #5: cannot open source input file "nordic_common.h": No such file or directory #include "nordic_common.h" ......\main.c: 0 warnings, 1 error compiling our_service.c... ......\our_service.h(40): error: #5: cannot open source input file "ble.h": No such file or directory #include "ble.h" ......\our_service.c: 0 warnings, 1 error compiling bsp.c... bsp.c: Error: #5: cannot open source input file "..........\bsp\bsp.c": No such file or directory ..........\bsp\bsp.c: 0 warnings, 1 error "._build\nrf52832_xxaa_s132.axf" - 3 Error(s), 0 Warning(s).

why and how to resolve it ?

  • The reason is that project file in that tutorial is set up to look for the included header files in the nRF5 SDK at some preset location. You can see that in Keil uVision, under Project -> Options for target -> C/C++ tab -> Include Paths.

    I prepared a screenshot of that but for some reason uploading it here keeps failing... If you want that let me know and I can try again.

    To solve this, you need to put the folder in the nRF5 SDK at a position so that the project could find the header files at those locations in include paths. One way to get that done quickly is:

    • Download and unzip nRF5 SDK v11.0.0
    • Copy/move the folder nrf5-ble-tutorial-service to nRF5_SDK_11.0.0_89a8197\examples\ble_peripheral\

    It is helpful to spend sometime to understand this. Once you got used to the way nRF5 SDK is structure and how projects are located, you could also make some new folders structure similar to the examples' folder structure to store Github tutorials and your projects. It helps differentiate those projects from stock examples. I personally set the examples as read-only to prevent accidental modification of reference codes. You would also need to copy nRF5_SDK_11.0.0_89a8197\examples\bsp to your new dedicate folders.

  • In fact i have copied it to the folder examples\ble_peripheral .But you remind me that the way of include file is not right,then i check the folder find that project way is not right because it is: \nrf51-ble-tutorial-service-master\nrf51-ble-tutorial-service-master\SDK 11.0.0\nrf5-ble-tutorial-service\pca10040\s132\arm5_no_packs\nrf52-ble-tutorial-service.uvprojx. So i modify to: nrf51-ble-tutorial-service-master\pca10040\s132\arm5_no_packs\nrf52-ble-tutorial-service.uvprojx.

    It is OK! thank you !

  • Oh I meant just move a subfolder of the project you downloaded, not the entire thing. But it seems you figured it out, so that is all good.

Related