Comments (7)
Good that you managed it.
from json.
You need to properly configure the library search path to the json/include
folder and then use #include <nlohmann/json.hpp>
.
from json.
You have said it's a header-only library. so inclduing that would be enough useually but it's not.
How to properly configure the library search path to the json/include?
from json.
You did not use the single header version which is in the single_include
folder. Otherwise, follow https://github.com/nlohmann/json?tab=readme-ov-file#integration.
from json.
The single_include
folder doesn't exist in the repo folder so I downloaded both json
and json_fwd
headers in the project directory and changed the code:
#include <iostream>
#include "json.hpp"
#include "json_fwd.hpp"
int main() {
auto j = R"(
{
"happy": true,
"pi": 3.141
}
)"_json;
auto data = j.dump();
std::cout << data << '\n';
return 0;
}
Error:
json.hpp:34:10: fatal error: nlohmann/adl_serializer.hpp: No such file or directory
34 | #include <nlohmann/adl_serializer.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
from json.
- You wrote that you cloned the repo, so there should be a
single_include
folder. Please check. - If you want to use the files in the
include
folder, then just includingjson.hpp
orjson_fwd.hpp
(don't include both, you probably only needjson.hpp
), then you must set your include path.
from json.
Downloaded the ZIP and inslcued json.hpp
and it runs. Thanks.
So the easiest way to use nlohmann-json is this way yeah?
from json.
Related Issues (20)
- CVE-2024-22190
- CVE-2024-3651
- CVE-2024-22195, CVE-2024-34064
- CVE-2024-35195
- Tornado vulnerabilities
- CVE-2024-37891
- CVE-2024-5569
- CVE-2024-39689
- CVE-2024-34062
- Coverity issues with Coverity 2024.6.0
- A lot of EOT in json file HOT 1
- Structure declared in natvis file template doesn't seem to match current structure of `basic_json<>`
- Assert when using std::views::filter and GCC 10
- Unexpected Integer Conversion of JSON Values on ARM64 HOT 1
- Library Cannot Parse JSON File It Wrote HOT 1
- parse OOM
- [bug] nlohmann::json constructor behaves improperly
- json_pointer - a code example from doc's does not compile HOT 1
- json parse enclosing json object with [] HOT 1
- Inconsisten operator[] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json.