-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Cant compile with -C++17 and beyond compiler options #1362
Comments
The error message suggests that you try to convert a JSON value to a user-defined type, but there was not conversion function found. I do not know how this relates to the title of the issue. Could you provide more information? |
It's hard to debug based on screen shots. Which version of the library are you using? Could you provide a small example demonstrating the issue? Which compiler are you using? |
I'm running against HEAD, let me gen up some example code to simplify |
#include <stdio.h>
#include "json.hpp"
int main(int argc, char **argv)
{
printf("hello world\n");
nlohmann::json _j;
std::string tmp = _j["test"]; // OK
//std::string tempstring;
try
{
std::string tempstring = _j["setting"]; // OK
}
catch( std::exception &ex )
{
}
std::string tempstring2;
try
{
tempstring2 = _j["setting"]; // FAIL
}
catch( std::exception &ex )
{
}
} |
Works just fine when compiling std==c++14, breaks when I attempt to go beyond C++14 |
Which compiler are you using? |
gcc thats built into codelite |
Which version is that? |
uhh, let me see.. ken@ken-PowerEdge-R420: ken@ken-PowerEdge-R420:~/git-repos/json$ |
Thank you. (This just took 4 questions to get all the information that was originally asked in the issue template :-/) |
my apologies. I've gotten rusty and lazy |
In my defense, I did at least read previous posts on C++17 compiling:) |
With GCC 7.3 on macOS
your code compiles without problems with
|
odd, could I trouble you to check -std=c++1z ? |
Works as well. |
Please give me your complete list of compile flags you are using |
Same with
|
No flags:
|
|
C++11 works fine, C++17 does not |
This is due to #958. There are multiple I suggest using |
Thanks! I'll use your suggested alternative |
@CalielOfSeptem Can I close the issue? |
Feel free to close this one, thank you.
…On Wed, Dec 12, 2018 at 4:15 PM Niels Lohmann ***@***.***> wrote:
@CalielOfSeptem <https://github.com/CalielOfSeptem> Can I close the issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1362 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADh5jSApU4sGb3I9TnFQJRphR7VdhbXnks5u4XH1gaJpZM4YoFus>
.
|
The error relates to this nlohmann/json#1362. Applying the suggested way to retrieve string fixes the issue
See image below. I've added the #include suggested by a previous post, but that does not seem to resolve this.
The text was updated successfully, but these errors were encountered: