CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Element is not a member..... [Solved]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JAM2014



Joined: 24 Apr 2014
Posts: 138

View user's profile Send private message

Element is not a member..... [Solved]
PostPosted: Tue Jun 05, 2018 11:50 am     Reply with quote

Hi All,

I've been using a GPS NMEA parsing routine from the code library for a while now, and it works well. The parsing routines did not return the Checksum, so I wanted to add that, but after doing so I'm encountering an error "element is not a member...."

Here is the Structure in question:
Code:

///////////////////////////////////////////////////////////////////////////////
typedef struct _DateTimeInfo
{
   int8 Day;
   int8 Month;
   int8 Year;
   int8 Hour;
   int8 Minute;
   int8 Second;
} DateTimeInfo;
////////////////////////////////////////
typedef struct _GPRMCInfo
{
   char Valid;
   DateTimeInfo DT;
   float Latitude;
   char N_S;
   float Longitude;
   char E_W;
   float Speed;
   int8 Checksum; <<< This was added!!!!
} GPRMCInfo;


I'm trying to access the checksum with this code:

Code:

fprintf(Diag, "Rcvd. Checksum: %02u\n\r", MyGPRMCInfo.Checksum);


This original structure arrangement has been working fine, but now won't compile after I added the 'int8 Checksum', and it's not obvious to me where the problem is!

Thanks,

Jack
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 05, 2018 12:53 pm     Reply with quote

The following test program compiles with zero errors or warnings with
compiler vs. 5.078:
Code:
#include <18F46K22.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOPBADEN
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS, stream=diag)

typedef struct _DateTimeInfo
{
   int8 Day;
   int8 Month;
   int8 Year;
   int8 Hour;
   int8 Minute;
   int8 Second;
} DateTimeInfo;


typedef struct _GPRMCInfo
{
   char Valid;
   DateTimeInfo DT;
   float Latitude;
   char N_S;
   float Longitude;
   char E_W;
   float Speed;
   int8 Checksum;   // <<< This was added!!!!
} GPRMCInfo;


// Create an instance of the structure.
GPRMCInfo MyGPRMCInfo;

//======================================
void main()
{     

fprintf(diag, "Rcvd. Checksum: %02u\n\r", MyGPRMCInfo.Checksum);

while(TRUE);
}
JAM2014



Joined: 24 Apr 2014
Posts: 138

View user's profile Send private message

PostPosted: Tue Jun 05, 2018 1:26 pm     Reply with quote

Hi All,

Yeah, that worked for me too, so I did some more digging.... Turns out I made the stupid mistake of loading the Include file that contains the Structure from a different working directory, and then trying to compile with the unmodified version of the file in the actual working directory!

Argh!!

Thanks for your input as it helped me to realize the issue was not 'code related', but 'programmer related' instead.......

Jack
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group