View previous topic :: View next topic |
Author |
Message |
davidnewone
Joined: 15 Feb 2018 Posts: 3
|
pb of compilation ... function used but not defined |
Posted: Thu Feb 15, 2018 3:16 pm |
|
|
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](images/smiles/icon_confused.gif) |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 15, 2018 7:32 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Feb 16, 2018 2:50 am |
|
|
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... |
|
![](templates/subSilver/images/spacer.gif) |
jeremiah
Joined: 20 Jul 2010 Posts: 1329
|
|
Posted: Fri Feb 16, 2018 9:44 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
davidnewone
Joined: 15 Feb 2018 Posts: 3
|
|
Posted: Fri Feb 16, 2018 12:18 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Feb 16, 2018 12:23 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 16, 2018 12:25 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Fri Feb 16, 2018 1:06 pm |
|
|
OK. I have to ask ..
What does 'pb' mean in the title ??
It's been a long week..so far 4 Mondays.....sigh.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Feb 16, 2018 1:16 pm |
|
|
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'. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Fri Feb 16, 2018 2:08 pm |
|
|
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](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Feb 16, 2018 3:47 pm |
|
|
For me it is lead.... |
|
![](templates/subSilver/images/spacer.gif) |
newguy
Joined: 24 Jun 2004 Posts: 1903
|
|
Posted: Fri Feb 16, 2018 5:08 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Sat Feb 17, 2018 2:23 am |
|
|
Good story, and I like the board. |
|
![](templates/subSilver/images/spacer.gif) |
davidnewone
Joined: 15 Feb 2018 Posts: 3
|
Of course, RTC ! |
Posted: Sat Feb 17, 2018 7:22 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|