Dear friends,
I have a small problem with hi-tech programming. usually I use C18 for programming but this time I have to use Hi-Tech C for PIC16 series because the code already exist based on this compiler and I wanna add some lines to get current date and time from PC due to setting the RTC chip.
Let me simplify the code as following:
code listing: hi-tech_test.c
----------------------------------------
#include <htc.h>
#include <time.h>
void
main(void) {
time_t td;
//struct tm * tp;
time(&td);
//tp = localtime(&td); //convert time_t to tm as local time
}
Build outcome in MPLAB:
--------------------------------------
Build C:\Users\Rowshan\MyCodes\PCW\rs485-rs232\hi-tech_test for device 16F877A
Using driver C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe
Make: The target "C:\Users\Rowshan\MyCodes\PCW\rs485-rs232\time_date_test.p1" is out of date.
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" --pass1 C:\Users\Rowshan\MyCodes\MPLAB\time_date_test.c -q --chip=16F877A -P --runtime=default,+clear,+init,-keep,+osccal,-download,-resetbits,-stackcall,+clib --opt=default,+asm,-debug,-speed,+space,9 --warn=0 -D__DEBUG=1 --double=24 --float=24 --addrqual=ignore --mode=lite -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" -ohi-tech_test.cof -mhi-tech_test.map --summary=default,-psect,-class,+mem,-hex --output=default,-inhx032 time_date_test.p1 --chip=16F877A -P --runtime=default,+clear,+init,-keep,+osccal,-download,-resetbits,-stackcall,+clib --opt=default,+asm,-debug,-speed,+space,9 --warn=0 -D__DEBUG=1 --double=24 --float=24 --addrqual=ignore --mode=lite -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83
Copyright (C) 2011 Microchip Technology Inc.
Licensed for evaluation purposes only.
This licence will expire on Wed, 11 Sep 2013.
Error [499] ; 0. undefined symbol:
_time(hi-tech_test.obj)
********** Build failed! **********
As you know about the error:
(499) undefined symbol: (Assembler, Linker)
The symbol following is undefined at link time. This could be due to spelling error, or
failure to link an appropriate module.
When I remove line "time(&td);", every thing is OK.
I checked also by other versions or compiler like 9.60 PRO or 9.65 Lite even by TIDE but still I face with this error.
I check this folder (C:\Program Files (x86)\HI-TECH Software\PICC\9.83\sources) and found out that there is not file for function time() in sources folder, maybe that's why it shows this error. I checked the folder of other versions, they didn't have this file as well.
Could any body help me to solve this problem?