Hello竟然出错!!

软件和网站开发以及相关技术探讨
回复
头像
Beetle
帖子: 1637
注册时间: 2005-10-14 16:55
系统: OS X
来自: 江苏
联系:

Hello竟然出错!!

#1

帖子 Beetle » 2007-04-27 22:21

第一次试着在linux下编程,结果出现这个问题!!环境都配好了~~

代码: 全选

$ gcc hello.c -o hello
hello.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘buffer’
hello.c:1: error: missing terminating ' character
hello.c:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘you’
hello.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘enter’
hello.c:3: error: missing terminating ' character
In file included from /usr/include/_G_config.h:44,
                 from /usr/include/libio.h:32,
                 from /usr/include/stdio.h:72,
                 from hello.c:4:
/usr/include/gconv.h:72: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/gconv.h:88: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/gconv.h:97: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/gconv.h:174: error: expected specifier-qualifier-list before ‘size_t’
In file included from /usr/include/stdio.h:72,
                 from hello.c:4:
/usr/include/libio.h:328: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:360: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:369: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:485: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from hello.c:4:
/usr/include/stdio.h:306: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:313: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:355: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:357: error: format string argument not a string type
/usr/include/stdio.h:359: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:608: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:614: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:636: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:638: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
头像
西纳乌卡
帖子: 188
注册时间: 2007-03-24 14:18

#2

帖子 西纳乌卡 » 2007-04-27 22:39

代码: 全选

wangliang@wangliang-desktop:~/c$ gcc hello.c -o hello 
wangliang@wangliang-desktop:~/c$ ./hello
hello world
wangliang@wangliang-desktop:~/c$
头像
Beetle
帖子: 1637
注册时间: 2005-10-14 16:55
系统: OS X
来自: 江苏
联系:

#3

帖子 Beetle » 2007-04-27 22:53

FT~~~到底什么问题?
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#4

帖子 BigSnake.NET » 2007-04-27 22:55

贴源吗
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
西纳乌卡
帖子: 188
注册时间: 2007-03-24 14:18

#5

帖子 西纳乌卡 » 2007-04-27 23:15

我试了n次都正常
难道是rpwt?
头像
xport
帖子: 1277
注册时间: 2006-05-19 21:23
联系:

#6

帖子 xport » 2007-04-27 23:31

得看到源代码才能说话,否则要猜的话会不会是Linux header的版本与你的Linux kernel版本不一致呢?
其实我是一个演员!-http://blog.csdn.net/xport/
头像
Beetle
帖子: 1637
注册时间: 2005-10-14 16:55
系统: OS X
来自: 江苏
联系:

#7

帖子 Beetle » 2007-04-28 12:29

代码: 全选

#include <stdio.h>

int main()

{
  printf("Hello,World\n");
}
成吉思汗~~~用vi写就没问题,用emacs就会出错!!难道真的是RPWT???
头像
zhan
帖子: 1880
注册时间: 2005-08-15 0:04
来自: 南7技校

#8

帖子 zhan » 2007-04-28 13:01

注意一下两个问题:
emacs 的当前编码环境
是否使用了全角标点
飞得高,飞得低,学习再学习,多少大秘密!
http://zhan.blog.ubuntu.org.cn
头像
Beetle
帖子: 1637
注册时间: 2005-10-14 16:55
系统: OS X
来自: 江苏
联系:

#9

帖子 Beetle » 2007-04-29 12:14

zhan 写了:注意一下两个问题:
emacs 的当前编码环境
是否使用了全角标点
把全角关了,不过emacs不是能自动识别编码环境的嘛~~
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#10

帖子 BigSnake.NET » 2007-04-29 12:20

lz应该是未安装基本编译环境
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
Beetle
帖子: 1637
注册时间: 2005-10-14 16:55
系统: OS X
来自: 江苏
联系:

#11

帖子 Beetle » 2007-04-29 14:44

BigSnake.NET 写了:lz应该是未安装基本编译环境
:em25 :em25 你是说emacs的还是什么?该装的都OK了!

现在问题是vi下没有问题,emacs不正常!可能的确是编码问题~~
头像
stlxv
论坛版主
帖子: 8275
注册时间: 2006-05-03 0:39
来自: المريخ

#12

帖子 stlxv » 2007-05-01 0:12

:shock:
PHP是最好的语言!不服来战!
SSLinux
帖子: 2
注册时间: 2007-06-10 11:18

#13

帖子 SSLinux » 2007-06-10 11:24

你可以试一下:
apt-get install glibc6-dev gcc g++
头像
wth123456
帖子: 234
注册时间: 2006-12-07 17:32

#14

帖子 wth123456 » 2007-06-27 12:17

没装开发包 v
回复