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 support@ccsinfo.com

pb of compilation ... function used but not defined

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



Joined: 15 Feb 2018
Posts: 3

View user's profile Send private message

pb of compilation ... function used but not defined
PostPosted: Thu Feb 15, 2018 3:16 pm     Reply with quote

Hi, have someone any idea ?? thanks a lot for you answers
Code:
           
struct tm
{
    int tm_sec;       /* secondes (0,59) */
    int tm_min;       /* minutes (0,59) */
    int tm_hour;      /* heures depuis minuit (0,23) */
    int tm_mday;      /* jour du mois (0,31) */
    int tm_mon;       /* mois depuis janvier (0,11) */
    int tm_year;      /* années écoulées depuis 1900 */
    int tm_wday;      /* jour depuis dimanche (0,6) */
    int tm_yday;      /* jour depuis le 1er janvier (0,365) */
    int tm_isdst;     /* Daylight Saving Time flag*/
}; 
    time_t Ttime;
    time(&Ttime);   //   Here is the pb of compilation  ..
   
    struct tm * t;   
    t = localtime(&Ttime);   
         
       int8 jour = t->tm_wday;
       int8 datej = t->tm_mday;
       int8 mois = t->tm_mon;
       int8 annees = t->tm_year;

       setDate (&jour, &datej, &mois, &annees);

Confused
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 15, 2018 7:32 pm     Reply with quote

You are probably using an older compiler version with bugs in the include files.

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=40086
You can edit the include file for your PIC (example: 18F26J50.h)
and rename the following structure to rtc_time_t as shown in bold below:
Quote:

typedef struct {
int8 tm_year;
int8 tm_temp; // Not used by built in functions, place holder do not use
int8 tm_mday;
int8 tm_mon;
int8 tm_hour;
int8 tm_wday;
int8 tm_sec;
int8 tm_min;
int8 tm_isdst; // Not used by built in functions
} rtc_time_t;

Then it should not give you an error.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 2:50 am     Reply with quote

The other possibility, since it is the function line that is complaining, not the data definitions, is that he is not including the actual code to supply the function. Quote from "time.h":

Quote:

/// This file only provides the prototypes and definitions needed to ///
/// proved a time alogrithm that follows the C standard library. You ///
/// also need to include/link the actual library that performs the time ///
/// base. As of this writing CCS provides the following compatible ///
/// timebase libraries: ///
/// rtcperipheral.c - for PICs with internal real time clock. ///
/// ds1305.c - external DS1305 real time clock. ///
/// rtcticks.c - Use a PIC's timer with CCS #use timer() library.


Time.h, only provides the prototypes. There have to be physical routines included as well to actually do the work...
jeremiah



Joined: 20 Jul 2010
Posts: 1314

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 9:44 am     Reply with quote

Ttelmah wrote:
The other possibility, since it is the function line that is complaining, not the data definitions, is that he is not including the actual code to supply the function. Quote from "time.h":

Time.h, only provides the prototypes. There have to be physical routines included as well to actually do the work...


I would agree. The error actually says that there is no definition for the function, which means, it isn't included or it is included below that function. Either way, the code at the function call hasn't yet seen a definition of the function.
davidnewone



Joined: 15 Feb 2018
Posts: 3

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 12:18 pm     Reply with quote

jeremiah wrote:
Ttelmah wrote:
The other possibility, since it is the function line that is complaining, not the data definitions, is that he is not including the actual code to supply the function. Quote from "time.h":

Time.h, only provides the prototypes. There have to be physical routines included as well to actually do the work...



I would agree. The error actually says that there is no definition for the function, which means, it isn't included or it is included below that function. Either way, the code at the function call hasn't yet seen a definition of the function.


I included my own time.h using a copy of official time.h. But the pb is still present. Nevertheless, a little bit different:
[img]http://zupimages.net/viewer.php?id=18/07/amq1.jpg[/img] (alt+q)
thanks for the help
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 12:23 pm     Reply with quote

You are missing the point.

time.h, _requires_ a separate set of code to give the actual code. The three available from CCS are:
rtcperipheral.c, ds1305.c & rtcticks.c, to use an internal timer, the hardware RTC peripheral of the ds1305 chip.
time.h is not designed to be used on it's own. It needs these other parts, or one to do the same job supplied by you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 12:25 pm     Reply with quote

Right, but the error shown in his image is about CPUDIV1.
He can fix it by changing it to NOCPUDIV. That's the correct fuse
for the 18F25J50 as shown in his image file.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 1:06 pm     Reply with quote

OK. I have to ask ..
What does 'pb' mean in the title ??
It's been a long week..so far 4 Mondays.....sigh.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 1:16 pm     Reply with quote

The original problem he is showing just an function used but not defined error for the line:

time(&Ttime); // Here is the pb of compilation ..

In the image he posts, he has probably just got something wrong in his modified file (as you say the CPUDIV fuse). However the underlined line, is because he is using time, not Ttime. Stupid naming.

Pb is a silly abbreviation for 'problem'.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 2:08 pm     Reply with quote

Thanks Mr. T !
Guess I'm showing my age...I'd NEVER have guessed 'pb' means problem. sigh. Doesn't take much to confuse me these 'dayze'... Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 3:47 pm     Reply with quote

For me it is lead....
newguy



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 5:08 pm     Reply with quote

Ttelmah wrote:
For me it is lead....


https://imgur.com/a/P5Eap

The story behind this is as follows. At work we have a little "kitchenette". My boss had a plastic cutting board which he used every day to cut sandwiches, fruit, etc. Until I caught a coworker placing the solder paste on it as he was taking it from the fridge. So for xmas I made the cutting board in the picture.

...Coworker is no longer around.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sat Feb 17, 2018 2:23 am     Reply with quote

Very Happy

Good story, and I like the board.
davidnewone



Joined: 15 Feb 2018
Posts: 3

View user's profile Send private message

Of course, RTC !
PostPosted: Sat Feb 17, 2018 7:22 am     Reply with quote

Ttelmah wrote:
You are missing the point.

time.h, _requires_ a separate set of code to give the actual code. The three available from CCS are:
rtcperipheral.c, ds1305.c & rtcticks.c, to use an internal timer, the hardware RTC peripheral of the ds1305 chip.
time.h is not designed to be used on it's own. It needs these other parts, or one to do the same job supplied by you.

Code:

setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1|RTCC_8_bit);      //51,2 us overflow

   //RTCC
   setup_rtc(RTC_ENABLE | RTC_OUTPUT_SOURCE, 0);
   wizardTempTime.tm_year = 0;
   wizardTempTime.tm_mon = 1;
   wizardTempTime.tm_mday = 1;
   wizardTempTime.tm_wday = 1;
   wizardTempTime.tm_hour = 0;
   wizardTempTime.tm_min = 0;
   wizardTempTime.tm_sec = 0;
   rtc_write(&wizardTempTime);


Now it s OK
Thanks all of you
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