fatal error: app_version.h: No such file or directory when using nRF5340 DK and nRF Connect for VSC and trying to implement Zephyr versioning

I am using the nRF Connect for Visual Studio Code Add-In running with the nRF Connect 2.5.0 toolchain and was trying to implement the application versioning on a nRF5340 DK following https://docs.zephyrproject.org/latest/build/version/index.html, but I get a fatal error: app_version.h: No such file or directory. I might be missing something but was reading:

To use the version information in application code, the version file must be included, then the fields can be freely used. The include file name is app_version.h (no path is needed)

 

So, it seems like it should work. I've tried with "" and <>.

Parents
  • Hello,

    Have you prepared a VERSION file for your project? If yes: is it located in the same directory as prj.conf? These requirements are described in the VERSION file section of the documentation you linked.

    Best regards,

    Maria

  • The answer is yes to both questions. It's hard to tell what might cause the error, but given it's an include problem, would that be the issue?

  • Hello,

    Thank you for your patience.

    I want to be sure that we are using the same methods. Please follow these instructions and report if you get the same build error:

    1. Verify that your toolchain version matches the NCS version.
    2. Add ncs/zephyr/samples/hello_world as an application in the nRF Connect for VS Code extension
    3. Create VERSION and save it to hello_world.
    4. Add 
      VERSION_MAJOR = 1
      VERSION_MINOR = 2
      PATCHLEVEL = 3
      VERSION_TWEAK = 4
      EXTRAVERSION = unstable
       to VERSION
    5. Add #include <app_version.h> to hello_world/src/main.c
    6. Create a build configuration for hello_world with nrf5340dk_nrf5340_cpuapp as the build target and build the sample.

    Best regards,

    Maria

  • I installed and set my apps toolchain to v2.5.0 and it's working now. I didn't really know what step 1 meant. I'm not even sure I know how to change the toolchains.

  • Have followed these instructions to the letter, but not working. File named VERSION 

    VERSION_MAJOR = 1
    VERSION_MINOR = 0
    PATCHLEVEL = 2
    VERSION_TWEAK = 0
    EXTRAVERSION = dev

    located at app root, next to prj.conf.

    Then in main.c

    // #include <app_version.h>
    #include <zephyr/app_version.h>
    
    
        LOG_INF("Version: %s, protocol: %s", CONFIG_APP_VERSION_STRING, protocol);

    Note - also, checked `docs.zephyrproject.org/.../index.html` which suggested slightly different #include. Also, does not work. 

    Error = 

    C:/ncs/smpl/src/main.c: In function 'main':
    C:/ncs/smpl/src/main.c:69:37: error: 'CONFIG_APP_VERSION_STRING' undeclared (first use in this function); did you mean 'CONFIG_APP_VERSION_SHELL'?
       69 |                 CONFIG_APP_VERSION, CONFIG_APP_VERSION_STRING, protocol);

Reply
  • Have followed these instructions to the letter, but not working. File named VERSION 

    VERSION_MAJOR = 1
    VERSION_MINOR = 0
    PATCHLEVEL = 2
    VERSION_TWEAK = 0
    EXTRAVERSION = dev

    located at app root, next to prj.conf.

    Then in main.c

    // #include <app_version.h>
    #include <zephyr/app_version.h>
    
    
        LOG_INF("Version: %s, protocol: %s", CONFIG_APP_VERSION_STRING, protocol);

    Note - also, checked `docs.zephyrproject.org/.../index.html` which suggested slightly different #include. Also, does not work. 

    Error = 

    C:/ncs/smpl/src/main.c: In function 'main':
    C:/ncs/smpl/src/main.c:69:37: error: 'CONFIG_APP_VERSION_STRING' undeclared (first use in this function); did you mean 'CONFIG_APP_VERSION_SHELL'?
       69 |                 CONFIG_APP_VERSION, CONFIG_APP_VERSION_STRING, protocol);

Children
No Data
Related