Skip to content

Compilation error on android arm64-v8a #913

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

Closed
ddovod opened this issue Apr 19, 2019 · 4 comments
Closed

Compilation error on android arm64-v8a #913

ddovod opened this issue Apr 19, 2019 · 4 comments

Comments

@ddovod
Copy link

ddovod commented Apr 19, 2019

Hi.
If you try to

Json::Value someJsonValue;
int64_t someIntValue = 45;  // <-- note on type
someJsonValue = someIntValue;  // <-- error

you'll get a compiler error error: conversion from 'int64_t' (aka 'long') to 'Json::Value' is ambiguous.
On iOS it compiles fine both for armv7 and arm64, but on android arm64-v8a long and long long are different enough to trigger compiler error, however both are 8 bytes.

@dota17
Copy link
Member

dota17 commented May 20, 2019

Hi @ddovod I've found some issues are much the same with your question here, and probably they may be able to resolve your concerns.

  1. Conversion of Json::Value to long int is ambiguous #64
  2. Write unsigned long to a json file #879
  3. Issue with 64-bit integers on 86_x64 Linux #509

@baylesj
Copy link
Contributor

baylesj commented Jun 28, 2019

Is JSON_HAS_INT64 defined as true? Value should have a setter explicitly for int64_t...

typedef int64_t Int64;

#if defined(JSON_HAS_INT64)
  Value(Int64 value);
  Value(UInt64 value);
#endif // if defined(JSON_HAS_INT64)

@ddovod
Copy link
Author

ddovod commented Jun 28, 2019

Hi. Probably it's fixed already because in our copy of jsoncpp config.h has this definitions of Int64 and UInt64:

#if defined(_MSC_VER) // Microsoft Visual Studio
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else                 // if defined(_MSC_VER) // Other platforms, use long long
typedef long long int Int64;
typedef unsigned long long int UInt64;
#endif // if defined(_MSC_VER)
typedef Int64 LargestInt;
typedef UInt64 LargestUInt;
#define JSON_HAS_INT64
#endif // if defined(JSON_NO_INT64)

but in master it is

#if defined(_MSC_VER) // Microsoft Visual Studio
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else                 // if defined(_MSC_VER) // Other platforms, use long long
typedef int64_t Int64;
typedef uint64_t UInt64;
#endif                // if defined(_MSC_VER)
typedef Int64 LargestInt;
typedef UInt64 LargestUInt;
#define JSON_HAS_INT64
#endif // if defined(JSON_NO_INT64)

I'll check that, thanks!

@baylesj
Copy link
Contributor

baylesj commented Jun 28, 2019

Ahh, cool. It's nice when updates fix things :).

Closing now, feel free to reopen/comment/message if it comes up again.

@baylesj baylesj closed this as completed Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants