作者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