Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This file requires compiler and library support .... #332

Closed
vertisan opened this issue Oct 14, 2016 · 7 comments
Closed

This file requires compiler and library support .... #332

vertisan opened this issue Oct 14, 2016 · 7 comments

Comments

@vertisan
Copy link

Hi,
I trying to use your library but when I trying to compile example I getting error:
error This file requires compiler and library support for the \ ISO C++ 2011 standard. This support is currently experimental, and must be \ enabled with the -std=c++11 or -std=gnu++11 compiler options.
I'm using Dev C++ 5.11. I setted language standard into ISO C++ 11 but I getting still the same error.
What is bad?

Windows 10 Home x64
Dev C++ 5.11
TDM-GCC 4.9.2 64-bit Release

@alex-lairan
Copy link

As you can see, GCC is on 6.2 now https://gcc.gnu.org/

You have to update your compiler to a newer version.

@nlohmann
Copy link
Owner

nlohmann commented Oct 15, 2016

GCC 4.9.2 should be capable to compile the library (in fact, there is a preprocessor check that yields an error if the compiler is too old). But as the error message says: you need to pass -std=c++11 to the compiler flags. I have not used Dev C++, so I do not know how to set the flags. Maybe search for CXXFLAGS.

@vertisan
Copy link
Author

vertisan commented Oct 15, 2016

Ok, I fix it.
I have one more question - how to convert JSON from file into array?
I'm loading file by:
json ss; std::ifstream ifs("data/test.json"); ifs >> ss;
and here is this JSON file:
{ "cols": [ "id", "title", "quantity", "price" ], "data": [ [ 1, "Guzman", 16, "6.31" ], [ 2, "Berry", 3, "4.34" ], [ 3, "Golden", 8, "4.15" ] ] }

@nlohmann
Copy link
Owner

I do not understand the question. To what type do you want to convert your JSON?

@vertisan
Copy link
Author

I have JSON:
{ "cols": [ "id", "title", "quantity", "price" ], "data": [ [ 1, "Guzman", 16, "6.31" ], [ 2, "Berry", 3, "4.34" ], [ 3, "Golden", 8, "4.15" ] ] }
and now I want to create array with this data.

@nlohmann
Copy link
Owner

Say your JSON object is stored in variable ss. Then you could access with ss["data"] the array

[
  [
    1,
    "Guzman",
    16,
    "6.31"
  ],
  [
    2,
    "Berry",
    3,
    "4.34"
  ],
  [
    3,
    "Golden",
    8,
    "4.15"
  ]
]

@vertisan
Copy link
Author

Thanks for help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants