在ubuntu下gcc编译失败什么原因啊

MrSean 2012-02-25 05:13:13
In file included from /usr/include/stdio.h:34,
from hello.c:2:
/usr/lib/gcc/i686-linux-gnu/4.4.5/include/stddef.h:211: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
In file included from /usr/include/stdio.h:75,
from hello.c:2:
/usr/include/libio.h:332: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:364: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:373: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:495: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from hello.c:2:
/usr/include/stdio.h:316: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:322: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:334: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:341: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:383: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:385: error: format string argument not a string type
/usr/include/stdio.h:387: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:659: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:662: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:672: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:702: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:708: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:730: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:732: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
hello.c: In function ‘main’:
hello.c:5: warning: missing terminating " character
hello.c:5: error: missing terminating " character
hello.c:6: error: expected expression before ‘}’ token
hello.c:6: error: expected ‘;’ before ‘}’ token
hello.c: At top level:
hello.c:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
root@fmh414888-virtual-machine:~# gcc -o hello hello.c
In file included from /usr/include/stdio.h:34,
from hello.c:2:
/usr/lib/gcc/i686-linux-gnu/4.4.5/include/stddef.h:211: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
In file included from /usr/include/stdio.h:75,
from hello.c:2:
/usr/include/libio.h:332: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:364: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:373: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:495: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from hello.c:2:
/usr/include/stdio.h:316: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:322: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:334: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:341: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:383: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:385: error: format string argument not a string type
/usr/include/stdio.h:387: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:659: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:662: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:672: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:702: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:708: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:730: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:732: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
hello.c: In function ‘main’:
hello.c:5: warning: missing terminating " character
hello.c:5: error: missing terminating " character
hello.c:6: error: expected expression before ‘}’ token
hello.c:6: error: expected ‘;’ before ‘}’ token
hello.c: At top level:
hello.c:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

错误原因一大堆看不懂啊
...全文
492 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nalisaki 2012-03-23
  • 打赏
  • 举报
回复
估計是從哪裏copy的代碼,代碼中有不能識別的字符。
MrSean 2012-02-25
  • 打赏
  • 举报
回复
#include<stdio.h>
int main()
{
printf("hello world");
return 0;
}
SoftLy 2012-02-25
  • 打赏
  • 举报
回复
把代码贴出来啊。。这么多错误可能的原因有很多啊

24,855

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧