作者yinyins (ㄅㄆㄇㄈ)
看板PttCurrent
標題mbbsd/fav.c 編譯失敗 @@
時間Mon Jan 2 15:14:19 2006
gcc42 抱怨說語法錯誤... 好像是我的 gcc 太古板了
FreeBSD_4.11 + gcc42 + ptt-current_r3257
錯誤訊息如下:
gcc -O -pipe -g -Os -Wall -pipe -DBBSHOME='"/home/bbs"' -I../include -I/usr/local/include -D__OS_MAJOR_VERSION__="4" -D__OS_MINOR_VERSION__="11-RELEASE-p13" -c fav.c
fav.c: In function `fav_item_allocate':
fav.c:274: syntax error before `*'
fav.c:275: `ft' undeclared (first use in this function)
fav.c:275: (Each undeclared identifier is reported only once
fav.c:275: for each function it appears in.)
fav.c:278: warning: control reaches end of non-void function
*** Error code 1
patch 如下,不知道修的對不對,供參考囉:
Index: mbbsd/fav.c
===================================================================
--- mbbsd/fav.c (revision 3257)
+++ mbbsd/fav.c (working copy)
@@ -266,12 +266,15 @@
*/
static fav_type_t *fav_item_allocate(int type)
{
- int size = get_type_size(type);
+ int size;
+ fav_type_t *ft;
+
+ size = get_type_size(type);
if (!size)
return NULL;
- fav_type_t *ft = (fav_type_t *)fav_malloc(sizeof(fav_type_t));
+ ft = (fav_type_t *)fav_malloc(sizeof(fav_type_t));
ft->fp = fav_malloc(size);
ft->type = type;
return ft;
--
因為害怕失去 所以不敢擁有
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.214.196