NeoGPS icon indicating copy to clipboard operation
NeoGPS copied to clipboard

NMEAdistance won't compile

Open mccgregory opened this issue 5 years ago • 11 comments

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 avatar Aug 01 '20 11:08 mccgregory

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?

mccgregory avatar Aug 01 '20 16:08 mccgregory

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.

bzroom avatar Aug 02 '20 07:08 bzroom

HI, thanks for your time. Fails with:

NMEAdistance:56:1: error: 'base' does not name a type base._lat = -253448688L;

NMEAdistance:57:1: error: 'base' does not name a type base._lon = 1310324914L; // Ayers Rock, AU

Best regards Greg

mccgregory avatar Aug 02 '20 08:08 mccgregory

You need to put those lines in a function, maybe setup() function. Cannot put code outside of a function.

On Sun, Aug 2, 2020, 1:04 AM mccgregory [email protected] wrote:

HI, thanks for your time.

Fails with:

NMEAdistance:56:1: error: 'base' does not name a type

base._lat = -253448688L;

NMEAdistance:57:1: error: 'base' does not name a type

base._lon = 1310324914L; // Ayers Rock, AU

Best regards

Greg

From: bzroom [email protected] Sent: 02 August 2020 08:30 To: SlashDevin/NeoGPS [email protected] Cc: mccgregory [email protected]; Author <[email protected]

Subject: Re: [SlashDevin/NeoGPS] NMEAdistance won't compile (#142)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667640110> , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AKT2MCL7FB5PYKS4F3G62KDR6UIZBANCNFSM4PRVFQSQ> . < https://github.com/notifications/beacon/AKT2MCMIN53I27A5OJOEY63R6UIZBA5CNFSM4PRVFQS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE7FWCLQ.gif>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667643120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKVCN3TVIDWSPXAABPHXXDR6UMZLANCNFSM4PRVFQSQ .

bzroom avatar Aug 02 '20 10:08 bzroom

Sorry, I’m a bit dim, and again thanks for your rapid feedback.

I don’t really understand…

You commented on the code, suggesting I try this: showing the original line commented out, and three new lines.

I assumed I was just replacing that line with the three lines?

Are you suggesting I create another function to call the Location_t Function?

Apologies for my lack of understanding – I’m a bit old and thick! Best regards Greg

mccgregory avatar Aug 02 '20 10:08 mccgregory

Post your whole code

On Sun, Aug 2, 2020, 3:13 AM mccgregory [email protected] wrote:

Sorry, I’m a bit dim, and again thanks for your rapid feedback.

I don’t really understand…

You commented on the code, suggesting I try this:

showing the original line commented out, and three new lines.

I assumed I was just replacing that line with the three lines?

Are you suggesting I create another function to call the Location_t Function?

Apologies for my lack of understanding – I’m a bit old and thick!

Best regards

Greg

From: bzroom [email protected] Sent: 02 August 2020 11:06 To: SlashDevin/NeoGPS [email protected] Cc: mccgregory [email protected]; Author <[email protected]

Subject: Re: [SlashDevin/NeoGPS] NMEAdistance won't compile (#142)

You need to put those lines in a function, maybe setup() function. Cannot put code outside of a function.

On Sun, Aug 2, 2020, 1:04 AM mccgregory <[email protected] <mailto: [email protected]> > wrote:

HI, thanks for your time.

Fails with:

NMEAdistance:56:1: error: 'base' does not name a type

base._lat = -253448688L;

NMEAdistance:57:1: error: 'base' does not name a type

base._lon = 1310324914L; // Ayers Rock, AU

Best regards

Greg

From: bzroom <[email protected] mailto:[email protected]

Sent: 02 August 2020 08:30 To: SlashDevin/NeoGPS <[email protected] <mailto: [email protected]> > Cc: mccgregory <[email protected] mailto:[email protected] ; Author <[email protected] mailto:[email protected]%0b

Subject: Re: [SlashDevin/NeoGPS] NMEAdistance won't compile (#142)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667640110> , or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AKT2MCL7FB5PYKS4F3G62KDR6UIZBANCNFSM4PRVFQSQ

. <

https://github.com/notifications/beacon/AKT2MCMIN53I27A5OJOEY63R6UIZBA5CNFSM4PRVFQS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE7FWCLQ.gif

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667643120 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABKVCN3TVIDWSPXAABPHXXDR6UMZLANCNFSM4PRVFQSQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667654136> , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AKT2MCNRDUI2RZ7YZHO5M23R6U3ABANCNFSM4PRVFQSQ> . < https://github.com/notifications/beacon/AKT2MCJ54KNBQRPLMQAXMCDR6U3ABA5CNFSM4PRVFQS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE7FZP6A.gif>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SlashDevin/NeoGPS/issues/142#issuecomment-667654858, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKVCN5V7WIJ5WSJXZAGUHLR6U353ANCNFSM4PRVFQSQ .

bzroom avatar Aug 02 '20 10:08 bzroom

😊

My whole code is the NMEAdistance code.

At this stage I’m trying NeoGPS out, learning what I can and can’t do.

It is a mini project in a bigger project – I just wanted something to display the accuracy of RTK GPS by displaying the distance between the BASE and the ROVER. Regards Greg

mccgregory avatar Aug 02 '20 10:08 mccgregory

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 avatar Aug 02 '20 11:08 bzroom

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

bzroom avatar Aug 02 '20 11:08 bzroom

Thanks again.

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

Sorry, the thread shows you gave me one example, which I commented on.

And then, now a new example – which appears to effective, it certainly compiles past that original error.

I now need to read some more of the NeoGPS documentation to fill out the other variables before I can fully compile it and then upload it and try it out.

Thanks for your time – hope you are not too dislocated by your efforts.

Oh, and the answers to your previous questions:

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

Sorry - Yes – how is this?

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

I sort of expected “Example Code” to work as is – more or less?

As far as I can see the NMEAdistance code, which after all, is meant to be example code, is calling an overloaded function Location_t with two long parameters. Location_t doesn’t seem to cope with longs.

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

I feel that the issue is probably that this code has been tested on a DUE or something like that not an ESP32, so that the variable type (float, double, long needs resolving)

I can probably resolve this myself – it just takes longer – I was merely reaching out… The reason I looked on this particular forum was perhaps to find out if other people had experienced this and I could then gently nudge me in the right direction.

Apologies if I upset you or wasted your time. Best regards Greg

mccgregory avatar Aug 02 '20 11:08 mccgregory

Thank you very match, it help me.

techbv avatar Sep 16 '20 14:09 techbv