当前位置: 技术问答>linux和unix
这种编译错误怎么回事
来源: 互联网 发布时间:2015-08-25
本文导语: 最简单的 hello! #include int main() { printf("aaaa"); exit(0); } 出错如下: $ gcc -0 h h.c /usr/lib/libm.a gcc: h: 没有那个文件或目录 gcc: unrecognized option `-0' h.c:1: parse error before "buffer" h.c:1:36: missing terminating ' cha...
最简单的 hello!
#include
int main()
{
printf("aaaa");
exit(0);
}
出错如下:
$ gcc -0 h h.c /usr/lib/libm.a
gcc: h: 没有那个文件或目录
gcc: unrecognized option `-0'
h.c:1: parse error before "buffer"
h.c:1:36: missing terminating ' character
h.c:1:36: warning: character constant too long
h.c:2: parse error before "you"
h.c:2: parse error before "that"
h.c:3: parse error before "enter"
h.c:3:36: missing terminating ' character
h.c:3:36: warning: character constant too long
In file included from /usr/include/_G_config.h:44,
from /usr/include/libio.h:32,
from /usr/include/stdio.h:72,
from h.c:5:
/usr/include/gconv.h:72: parse error before "size_t"
/usr/include/gconv.h:88: parse error before "size_t"
/usr/include/gconv.h:97: parse error before "size_t"
/usr/include/gconv.h:174: parse error before "size_t"
/usr/include/gconv.h:177: parse error before '}' token
In file included from /usr/include/libio.h:32,
from /usr/include/stdio.h:72,
from h.c:5:
/usr/include/_G_config.h:47: field `__cd' has incomplete type
/usr/include/_G_config.h:50: field `__cd' has incomplete type
In file included from /usr/include/stdio.h:72,
from h.c:5:
/usr/include/libio.h:350: parse error before "size_t"
/usr/include/libio.h:359: parse error before "size_t"
/usr/include/libio.h:467: parse error before "_IO_sgetn"
/usr/include/libio.h:467: parse error before "size_t"
In file included from h.c:5:
/usr/include/stdio.h:281: parse error before "size_t"
/usr/include/stdio.h:288: parse error before "size_t"
/usr/include/stdio.h:319: parse error before "size_t"
/usr/include/stdio.h:323: parse error before "size_t"
/usr/include/stdio.h:491: parse error before "fread"
/usr/include/stdio.h:491: parse error before "size_t"
/usr/include/stdio.h:494: parse error before "fwrite"
/usr/include/stdio.h:494: parse error before "size_t"
/usr/include/stdio.h:506: parse error before "fread_unlocked"
/usr/include/stdio.h:506: parse error before "size_t"
/usr/include/stdio.h:508: parse error before "fwrite_unlocked"
/usr/include/stdio.h:508: parse error before "size_t"
/usr/include/gconv.h:176: warning: array `__data' assumed to have one element
#include
int main()
{
printf("aaaa");
exit(0);
}
出错如下:
$ gcc -0 h h.c /usr/lib/libm.a
gcc: h: 没有那个文件或目录
gcc: unrecognized option `-0'
h.c:1: parse error before "buffer"
h.c:1:36: missing terminating ' character
h.c:1:36: warning: character constant too long
h.c:2: parse error before "you"
h.c:2: parse error before "that"
h.c:3: parse error before "enter"
h.c:3:36: missing terminating ' character
h.c:3:36: warning: character constant too long
In file included from /usr/include/_G_config.h:44,
from /usr/include/libio.h:32,
from /usr/include/stdio.h:72,
from h.c:5:
/usr/include/gconv.h:72: parse error before "size_t"
/usr/include/gconv.h:88: parse error before "size_t"
/usr/include/gconv.h:97: parse error before "size_t"
/usr/include/gconv.h:174: parse error before "size_t"
/usr/include/gconv.h:177: parse error before '}' token
In file included from /usr/include/libio.h:32,
from /usr/include/stdio.h:72,
from h.c:5:
/usr/include/_G_config.h:47: field `__cd' has incomplete type
/usr/include/_G_config.h:50: field `__cd' has incomplete type
In file included from /usr/include/stdio.h:72,
from h.c:5:
/usr/include/libio.h:350: parse error before "size_t"
/usr/include/libio.h:359: parse error before "size_t"
/usr/include/libio.h:467: parse error before "_IO_sgetn"
/usr/include/libio.h:467: parse error before "size_t"
In file included from h.c:5:
/usr/include/stdio.h:281: parse error before "size_t"
/usr/include/stdio.h:288: parse error before "size_t"
/usr/include/stdio.h:319: parse error before "size_t"
/usr/include/stdio.h:323: parse error before "size_t"
/usr/include/stdio.h:491: parse error before "fread"
/usr/include/stdio.h:491: parse error before "size_t"
/usr/include/stdio.h:494: parse error before "fwrite"
/usr/include/stdio.h:494: parse error before "size_t"
/usr/include/stdio.h:506: parse error before "fread_unlocked"
/usr/include/stdio.h:506: parse error before "size_t"
/usr/include/stdio.h:508: parse error before "fwrite_unlocked"
/usr/include/stdio.h:508: parse error before "size_t"
/usr/include/gconv.h:176: warning: array `__data' assumed to have one element
|
gcc -o h h.c
|
你打错了吧,这么简单的程序,你用gcc hello.c就可以了
|
是gcc h.c
看错了,呵呵
看错了,呵呵
|
gcc -o h h.c吧,是不是把-o敲成-0了?
|
估计是你敲错了
|
嘻嘻~ 看了一下~ 好像是 -O 而不是 -0哦~ 0还是要瘦很多的
|
up