【发布时间】:2015-11-30 14:17:15
【问题描述】:
我正在创建一个程序来保存当天的天气信息。运行代码后,我得到 struct tm redefined 错误。我使用 Visual c++ 2008 作为编译器在代码块中运行它
这是我的代码:
#include<stdio.h>
#include<string.h>
#include<time.h>
struct tm //date template
{
int tm_mday //day of month
int tm_mon; //month of year
int tm_year; //year
//char date[11];
};
struct weather
{
struct tm *wdate1;
int high_temp;
int low_temp;
int max_wind_speed;
int preciption;
char note[80];
};
int main()
{
time_t wdate;
struct weather info[3];
ctime(&wdate);
printf("%s",wdate);
return 0;
}
【问题讨论】:
-
"运行代码后" -> "编译代码后"。编译时错误和运行时错误之间的巨大差异。
标签: c++ pointers time user-defined-functions