Json: Installing on Ubuntu 16.04

Created on 9 Aug 2019  路  5Comments  路  Source: nlohmann/json

  • Describe what you want to achieve.

I would like to install the nlohmann_json v3.7.0 and use it in a c++ project.

  • Describe what you tried.
  • Download the zip file to my Ubuntu 16.04 machine.
  • Unzip the package
  • mkdir build
  • cd build
  • cmake ..
  • make
  • make install

In my CMakeLists.txt i added:

find_package(nlohmann_json 3.7.0 REQUIRED)
target_link_libraries(configuration PRIVATE nlohmann_json::nlohmann_json)
  • Describe which system (OS, compiler) you are using.

Ubuntu 16.04
cmake version 3.5.2
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)

  • Describe which version of the library you are using (release version, develop branch).

nlohmann_json v3.7.0

  • Describe the problem

When I try to build I get the following error:

  Could not find a configuration file for package "nlohmann_json" that is
  compatible with requested version "3.7.0".

  The following configuration files were considered but not accepted:

    /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonConfig.cmake, version: 3.7.0 (64bit)
question stale

Most helpful comment

I have the same issue.
Looks like ubuntu 16.04 xenial can't install the nlohmann package

sudo apt-get install nlohmann-json-dev

always shows to me, can't locate the package

All 5 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I have the same issue.
Looks like ubuntu 16.04 xenial can't install the nlohmann package

sudo apt-get install nlohmann-json-dev

always shows to me, can't locate the package

@AustinJia apt packages an old version of json (2.1.1-1.1) that doesn't seem to support this method.

sudo apt-get install nlohmann-json3-dev helped me

sudo apt-get install nlohmann-json3-dev helped me

i get an error:
Unable to locate package nlohmann-json3-dev

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MariaRamos89 picture MariaRamos89  路  4Comments

bassosimone picture bassosimone  路  3Comments

Prati369 picture Prati369  路  4Comments

mlund picture mlund  路  4Comments

sqwunkly picture sqwunkly  路  3Comments