我寫了下面的代碼:警告:投以指針不同大小的整數
struct DVDARRAY
{
int length;
pDVD* dvds;
};
typedef struct DVDARRAY DVDARRAY_t;
//...
int main()
{
int i;
char c;
DVDARRAY_t* dvds;
poDAOproperties props;
props = get_dao_properties();
dvds = (DVDARRAY_t*) DVDDAO_read_raw_filter(props, "id = 1");
printf("title->: %s", dvds->dvds[0]->title);
}
,並在另一個文件中的以下定義:
DVDARRAY_t* DVDDAO_read_raw_filter(poDAOproperties properties, char* filter)
{
DVDARRAY_t *dvds;
// ...some code...
dvds = malloc(sizeof(DVDARRAY_t));
// ...some code...
return dvds;
}
現在我的問題:當我嘗試編譯這些文件我得到以下警告:
src/main.c: In Funktion »main«:
src/main.c:80:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
main.c中的80號線正是行:
dvds = (DVDARRAY_t*) DVDDAO_read_raw_filter(props, "id = 1");
我該怎麼辦?
我不會說德語。您能否將錯誤信息翻譯成英文,法文,拉丁文或匈牙利文? – 2013-04-21 19:12:57
幫我們忙,在張貼到SO時使用'LANG = C gcc' – sehe 2013-04-21 19:12:59
這兩個文件中是否定義了struct DVDARRAY_t? – Bort 2013-04-21 19:15:51