This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

"multiple definition of " and "undeclared here (not in a function); did you mean" errors when including nvs library

Hi,

I am getting errors when attempting to include the nvs library to save data to flash storage on the nRF9160 DK. My CMakeLists.txt:

cmake_minimum_required(VERSION 3.13.1)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(sample)

target_sources(app PRIVATE src/main.c)
#target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/fs/nvs)

I get the same errors with or without the last line commented out. Errors:

When attempting to include the nvs library in the src folder of a project, I get these errors:

With this CMakeLists.txt:

#
# Copyright (c) 2019 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#

cmake_minimum_required(VERSION 3.13.1)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(project)

target_sources(app PRIVATE src/main.c)

#libraries
zephyr_include_directories(src)

target_sources(app PRIVATE src/call/maincall.c)
target_sources(app PRIVATE src/nvs/nvs.c)

Also, there a detailed tutorial or guide on including files and libraries into projects? If not, it would be very useful for one to exist. 

Thanks

Parents
  • Hello, 

    I am getting errors when attempting to include the nvs library to save data to flash storage on the nRF9160 DK

     Have you looked at the NVS example that is available in the Zephyr tree (zephyr\samples\subsys\nvs\)? Does this give the same errors?

    Edit: Pay especially attention to the NVS flags in prj.conf file (zephyr\samples\subsys\nvs\prj.conf). This should include the correct libraries in your project.

    Edit 2: Have a look at the Zephyr documentation, especially the section regarding Application Configuration

    Kind regards,

    Øyvind

Reply
  • Hello, 

    I am getting errors when attempting to include the nvs library to save data to flash storage on the nRF9160 DK

     Have you looked at the NVS example that is available in the Zephyr tree (zephyr\samples\subsys\nvs\)? Does this give the same errors?

    Edit: Pay especially attention to the NVS flags in prj.conf file (zephyr\samples\subsys\nvs\prj.conf). This should include the correct libraries in your project.

    Edit 2: Have a look at the Zephyr documentation, especially the section regarding Application Configuration

    Kind regards,

    Øyvind

Children
Related