ubuntu10.10的helloworld程序问题?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
clleady
帖子: 40
注册时间: 2011-02-06 9:41

ubuntu10.10的helloworld程序问题?

#1

帖子 clleady » 2011-02-06 22:46

#include <stdio.h>
int
main(void)
{
printf("Hello, world!\n");
return 0;
}

已经安装了g++和gcc4

我的命令及显示如下:
apple@apple-pc:/linux/mytest$ sudo gedit hello.c
apple@apple-pc:/linux/mytest$ gcc -Wall hello.c -o hello
/usr/bin/ld: cannot open output file hello: Permission denied
collect2: ld returned 1 exit status

为什么呢?难到自带的gcc4不好用?
头像
astolia
论坛版主
帖子: 6450
注册时间: 2008-09-18 13:11

Re: ubuntu10.10的helloworld程序问题?

#2

帖子 astolia » 2011-02-06 23:33

你编辑知道用sudo,gcc怎么就不用了?
头像
速腾1994
论坛版主
帖子: 17379
注册时间: 2008-11-01 20:43
系统: Arch+gnome

Re: ubuntu10.10的helloworld程序问题?

#3

帖子 速腾1994 » 2011-02-07 10:02

:em05 :em05
天使ッ翼
帖子: 679
注册时间: 2010-06-19 11:44

Re: ubuntu10.10的helloworld程序问题?

#4

帖子 天使ッ翼 » 2011-02-07 10:32

你更改下你的源码文件的权限
chmod 666 hello.c
gcc hello.c -o hello
clleady
帖子: 40
注册时间: 2011-02-06 9:41

Re: ubuntu10.10的helloworld程序问题?

#5

帖子 clleady » 2011-02-07 11:02

谢谢大侠。
回复