当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 7 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 高手来看看!程序编译错误。
帖子发表于 : 2008-04-11 7:58 

注册: 2007-11-20 14:10
帖子: 23
送出感谢: 0 次
接收感谢: 0 次
编译中输入的命令:
sc@sc-desktop:~/workspace/chord$ gcc -I/home/sc/workspace/chord/include/ -I/usr/src/linux-headers-2.6.22-14-generic/include/ -I/usr/src/linux-headers-2.6.22-14-generic/include/linux/ -l/usr/lib main.c

In file included from /usr/include/_G_config.h:44,
from /usr/include/libio.h:32,
from /usr/include/stdio.h:75,
from main.c:2:
/usr/include/gconv.h:72: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/gconv.h:88: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/gconv.h:97: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/gconv.h:174: 错误: expected specifier-qualifier-list before ‘size_t’
In file included from /usr/include/stdio.h:75,
from main.c:2:
/usr/include/libio.h:329: 错误: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:361: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:370: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:486: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from main.c:2:
/usr/include/stdio.h:312: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:319: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:361: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:363: 错误: 格式字符串实参不是字符串玵型
/usr/include/stdio.h:365: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:614: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:620: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:642: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:644: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
In file included from main.c:4:
/usr/include/stdlib.h:140: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__ctype_get_mb_cur_max’
In file included from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:438,
from main.c:4:
/usr/src/linux-headers-2.6.22-14-generic/include/linux/time.h:13: 错误: expected specifier-qualifier-list before ‘time_t’
/usr/src/linux-headers-2.6.22-14-generic/include/linux/time.h:19: 错误: expected specifier-qualifier-list before ‘time_t’
In file included from /usr/include/sys/select.h:46,
from /usr/include/sys/types.h:220,
from /usr/include/stdlib.h:438,
from main.c:4:
/usr/include/bits/time.h:70: 错误: ‘struct timeval’ 重定义
In file included from main.c:4:
/usr/include/stdlib.h:455: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:485: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:487: 错误: 非空的实参操作数号越界(实参 1,操作数 4)
/usr/include/stdlib.h:589: 错误: expected ‘)’ before ‘__size’
/usr/include/stdlib.h:591: 错误: expected ‘)’ before ‘__nmemb’
/usr/include/stdlib.h:600: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from /usr/include/stdlib.h:612,
from main.c:4:
/usr/include/alloca.h:33: 错误: expected ‘)’ before ‘__size’
In file included from main.c:4:
/usr/include/stdlib.h:617: 错误: expected ‘)’ before ‘__size’
/usr/include/stdlib.h:622: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:622: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:774: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:774: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:775: 错误: 非空的实参操作数号越界(实参 1,操作数 5)
/usr/include/stdlib.h:779: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:779: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:780: 错误: 非空的实参操作数号越界(实参 1,操作数 4)
/usr/include/stdlib.h:852: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:855: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:859: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:863: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:872: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:875: 错误: expected ‘)’ before ‘*’ token
/usr/include/stdlib.h:879: 错误: expected declaration specifiers or ‘...’ before ‘wchar_t’
/usr/include/stdlib.h:883: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mbstowcs’
/usr/include/stdlib.h:886: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘wcstombs’
In file included from /usr/src/linux-headers-2.6.22-14-generic/include/linux/signal.h:4,
from main.c:5:
/usr/src/linux-headers-2.6.22-14-generic/include/asm/signal.h:32: 错误: 与 ‘sigset_t’ 类型冲突
/usr/include/sys/select.h:38: 错误: ‘sigset_t’ 的上一个声明在此
In file included from /usr/src/linux-headers-2.6.22-14-generic/include/linux/signal.h:4,
from main.c:5:
/usr/src/linux-headers-2.6.22-14-generic/include/asm/signal.h:154: 错误: expected specifier-qualifier-list before ‘size_t’
In file included from /usr/src/linux-headers-2.6.22-14-generic/include/asm/siginfo.h:4,
from /usr/src/linux-headers-2.6.22-14-generic/include/linux/signal.h:5,
from main.c:5:
/usr/src/linux-headers-2.6.22-14-generic/include/asm-generic/siginfo.h:56: 错误: expected specifier-qualifier-list before ‘timer_t’
/usr/src/linux-headers-2.6.22-14-generic/include/asm-generic/siginfo.h:75: 错误: expected specifier-qualifier-list before ‘clock_t’
main.c: 在函数 ‘main’ 中:
main.c:28: 警告: 隐式声明与内建函数 ‘calloc’ 不兼容

我的 gcc可以编译网上下载的源代码,也就是说编译器是没问题的,程序中出了这么多错误,看了一下,它引用了/usr/include下的stdlib.h文件,可是我并没有指定该include目录呀,系统是怎么找到该目录下的文件的?
而且stdlib.h是系统头文件,肯定没有错误的,为什么出这么多错误?

我编译的程序是从网上找的chord算法的源代码,包括7个c文件和8个头文件。


页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2008-04-11 8:53 
头像

注册: 2006-04-12 20:05
帖子: 8495
地址: 杭州
送出感谢: 0 次
接收感谢: 8
看清楚你下载的文件要求上面版本的内核,上面版本的库.这种问题一般都是版本不兼容之类的.


_________________
关注我的blog: ε==3


页首
 用户资料  
 
3 楼 
 文章标题 :
帖子发表于 : 2008-04-11 9:53 

注册: 2007-11-20 14:10
帖子: 23
送出感谢: 0 次
接收感谢: 0 次
谢谢bones7456,放弃编译这个源代码了,的确太老了,是2005年的。


页首
 用户资料  
 
4 楼 
 文章标题 :
帖子发表于 : 2008-04-13 20:54 

注册: 2007-11-20 14:10
帖子: 23
送出感谢: 0 次
接收感谢: 0 次
不是版本问题 ,后来发现是我的环境问题


页首
 用户资料  
 
5 楼 
 文章标题 :
帖子发表于 : 2008-08-28 17:31 

注册: 2008-08-28 17:29
帖子: 2
送出感谢: 0 次
接收感谢: 0 次
楼上的能不能说得再明白一些?
什么环境问题,如何解决的?
我现在也遇到了这个问题,是在交叉编译的时候遇到的。
想参考一下你的解决办法。
谢谢了


页首
 用户资料  
 
6 楼 
 文章标题 : Re: 高手来看看!程序编译错误。
帖子发表于 : 2009-12-16 11:19 

注册: 2008-08-07 12:32
帖子: 5
送出感谢: 0 次
接收感谢: 0 次
哎,我也遇到这个问题,再找解决方法,如果有人会的话麻烦发下!!


页首
 用户资料  
 
7 楼 
 文章标题 : Re: 高手来看看!程序编译错误。
帖子发表于 : 2013-08-10 16:43 

注册: 2013-08-10 16:40
帖子: 1
系统: win7
送出感谢: 0 次
接收感谢: 0 次
linfengfeiye, linfengfeiye, linfengfeiye,
我想想知道楼主是咋解决的


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 7 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译