在FreeBSD下调试C++时出现的错误,请问这是什么原因啊?
make -f Makefile.hello_DEBUG ...
g++ -c -o gettime.o -c -g gettime.cpp
gettime.cpp: In function `int getmytime(TIMETYPE*)':
//chatserver/home/zab/zab/hello/gettime.cpp(10): error: invalid conversion from `long int*' to `time_t*'
//chatserver/home/zab/zab/hello/gettime.cpp(10): error: initializing argument 1 of `time_t time(time_t*)'
//chatserver/home/zab/zab/hello/gettime.cpp(11): error: invalid conversion from `long int*' to `const time_t*'
//chatserver/home/zab/zab/hello/gettime.cpp(11): error: initializing argument 1 of `tm* localtime(const time_t*)'
*** Error code 1
Stop in /home/zab/zab/hello.
Leave the directory: /home/zab/zab/hello
*********Make Finished*********
/* gettime.cpp */
#include "time.h"
#include "adatetime.h"
int getmytime(TIMETYPE *t)
{
long ti;
struct tm *tm;
time(&ti);
tm=localtime(&ti);
t->hour=tm->tm_hour;
t->min=tm->tm_min;
t->sec=tm->tm_sec;
return 0;
}
adatetime.h
#ifndef __DATETIME_H
#define __DATETIME_H
/* date struct */
typedef struct
{
int year;
int mon;
int day;
}DATETYPE;
/* time struct */
typedef struct
{
char hour;
char min;
char sec;
}TIMETYPE;
int getmydate(DATETYPE *d); /* get current date */
int getmytime(TIMETYPE *t); /* get current time */
#endif