+ -
当前位置:首页 → 问答吧 → C语言

C语言

时间:2011-09-26

来源:互联网

这是神么状况 我用的11。04ubuntu和gcc4。6。1
编一个在屏幕上输出hello,world!的傻瓜程序段,就出错了

lichstonesking@lichstonesking-virtual-machine:~$ vi hello.c 开始编程

lichstonesking@lichstonesking-virtual-machine:~$ gcc -wall hello.c 程序省略了保证和教程上打的一模一样
gcc: unrecognized option '-wall'

hello.c: In function ‘main’:

hello.c:5:11: error: stray ‘\302’ in program

hello.c:5:11: error: stray ‘\250’ in program

hello.c:5:20: error: ‘hello’ undeclared (first use in this function)

hello.c:5:20: note: each undeclared identifier is reported only once for each function it appears in

hello.c:5:26: error: ‘world’ undeclared (first use in this function)

hello.c:5:31: error: expected ‘)’ before ‘!’ token

hello.c:5:31: error: stray ‘\’ in program

hello.c:5:31: error: stray ‘\302’ in program

hello.c:5:31: error: stray ‘\250’ in program

lichstonesking@lichstonesking-virtual-machine:~$ ^C

lichstonesking@lichstonesking-virtual-machine:~$

作者: lichstonesking   发布时间: 2011-09-26

好吧,hello_world.c
代码:
#include <stdio.h>
int main() {
        printf("Hello world!");
        return 1;
}

作者: everyx   发布时间: 2011-09-26

代码: [ 下载 ] [ 隐藏 ]
代码: [ 下载 ] [ 显示 ]
使用 c 语法高亮
#included<stdio.h>
void main()
{
printf("hello world");
}
格式化 0.002 秒, 使用 GeSHi 1.0.8.4

作者: 月下叹逍遥   发布时间: 2011-09-26

月下叹逍遥 写道:
代码: [ 下载 ] [ 隐藏 ]
代码: [ 下载 ] [ 显示 ]
使用 c 语法高亮
#included<stdio.h>
void main()
{
printf("hello world");
}
格式化 0.002 秒, 使用 GeSHi 1.0.8.4


你暴露了,M$程序员。
代码: [ 下载 ] [ 隐藏 ]
代码: [ 下载 ] [ 显示 ]
使用 c 语法高亮
#include <stdio.h>
int main (void)
{
    printf("hello world");
    return 0;
}
格式化 0.002 秒, 使用 GeSHi 1.0.8.4


LZ贴代码啊,不贴代码怎么知道什么错误。

作者: cuihao   发布时间: 2011-09-26

-wall 注意应该是-Wall w是大写的

作者: 飞火流星   发布时间: 2011-09-26

cuihao 写道:
月下叹逍遥 写道:
代码: [ 下载 ] [ 隐藏 ]
代码: [ 下载 ] [ 显示 ]
使用 c 语法高亮
#included<stdio.h>
void main()
{
printf("hello world");
}
格式化 0.002 秒, 使用 GeSHi 1.0.8.4


你暴露了,M$程序员。
代码: [ 下载 ] [ 隐藏 ]
代码: [ 下载 ] [ 显示 ]
使用 c 语法高亮
#include <stdio.h>
int main (void)
{
    printf("hello world");
    return 0;
}
格式化 0.002 秒, 使用 GeSHi 1.0.8.4


LZ贴代码啊,不贴代码怎么知道什么错误。

佛无南北,c无ml。。。

作者: 月下叹逍遥   发布时间: 2011-09-26