我正在創建一個程序來保存當天的天氣信息。運行代碼後,我得到了struct tm重新定義的錯誤。我使用的Visual C++ 2008的編譯器C++時間結構錯誤
在這裏,在代碼塊運行,這是我的代碼:
#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;
}
「運行代碼後」 - >「*編譯*代碼後」。編譯時錯誤和運行時錯誤之間的巨大差異。 – crashmstr