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

NMEAdistance won't compile #142

Open
mccgregory opened this issue Aug 1, 2020 · 11 comments
Open

NMEAdistance won't compile #142

mccgregory opened this issue Aug 1, 2020 · 11 comments

Comments

@mccgregory
Copy link

Trying to use NMEAdistance with an ESP32 but it fails to compile with the following error:
"NMEAdistance:54:51: error: call of overloaded 'Location_t(long int, long int)' is ambiguous"

It is referring to the line:
NeoGPS::Location_t base( -253448688L, 1310324914L ); // Ayers Rock, AU

If anybody could give me a pointer?

@mccgregory
Copy link
Author

The Latitude and Longitude in NMEAdistance are specified as LONG i.e. ( -253448688L, 1310324914L )
But in Location.h, Location_t is expecting two DOUBLEs.
here:
Location_t( double lat, double lon )
: _lat(lat / LOC_SCALE), _lon(lon / LOC_SCALE)
{}
Sorry, I'm not a programmer, how do I resolve this?
I can get rid of the compilation error by "getting the L out of it" (so to speak) with: ( -253448688, 1310324914 ).
But surely that will create a new problem?

@bzroom
Copy link

bzroom commented Aug 2, 2020

try this:
//NeoGPS::Location_t base( -253448688L, 1310324914L ); // Ayers Rock, AU
NeoGPS::Location_t base;
base._lat = -253448688L;
base._lon =1310324914L; // Ayers Rock, AU

Or this:
NeoGPS::Location_t base( (int32_t)-253448688L, (int32_t)1310324914L ); // Ayers Rock, AU

Honestly i dunno which one is right, but they both compile for me.

@mccgregory
Copy link
Author

mccgregory commented Aug 2, 2020 via email

@bzroom
Copy link

bzroom commented Aug 2, 2020 via email

@mccgregory
Copy link
Author

mccgregory commented Aug 2, 2020 via email

@bzroom
Copy link

bzroom commented Aug 2, 2020 via email

@mccgregory
Copy link
Author

mccgregory commented Aug 2, 2020 via email

@bzroom
Copy link

bzroom commented Aug 2, 2020

Can you figure out how not to copy the whole thread every time you reply?

You need to put code inside a function. Ask a c++ programmer.

You being dim is not an NeoGPS issue. Try some c++ forums or Discord.

@bzroom
Copy link

bzroom commented Aug 2, 2020

just use this one. FFS i gave you 2 examples:
NeoGPS::Location_t base( (int32_t)-253448688L, (int32_t)1310324914L ); // Ayers Rock, AU

@mccgregory
Copy link
Author

mccgregory commented Aug 2, 2020 via email

@techbv
Copy link

techbv commented Sep 16, 2020

Thank you very match, it help me.

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