免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2714 | 回复: 4
打印 上一主题 下一主题

编译出错,请问应从何入手解决?谢谢 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-01-11 17:00 |只看该作者 |倒序浏览
在rhel3中运行
gcc -O -o scan_for_matches ggpunit.c scan_for_matches.c
产生以下错误信息:

ggpunit.c:235: conflicting types for `malloc'
/usr/include/stdlib.h:556: previous declaration of `malloc'

在RHEL5平台上产生的错误信息要多些,多了第二个文件的出错信息,内容大致相同

c源文件见附件 ScanForMatches.zip (24.11 KB, 下载次数: 44) ,来自下面网站
http://www-unix.mcs.anl.gov/compbio/PatScan/HTML/patscan.html

[ 本帖最后由 飞行员舒克 于 2008-1-11 17:15 编辑 ]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2008-01-11 17:04 |只看该作者
你不能主动把代码贴上或者用附件?
为了帮你找错误,还得去下载代码,
你觉得有多少人愿意这样做?

论坛徽章:
0
3 [报告]
发表于 2008-01-11 17:10 |只看该作者
谢谢提醒!
麻烦您了!

[ 本帖最后由 飞行员舒克 于 2008-1-11 17:13 编辑 ]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
4 [报告]
发表于 2008-01-11 17:19 |只看该作者
我编译了一下你的代码,只是一些警告。
并没有错误出现。
-bash-3.00$ gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: /net/tibia/export/bldmstr/nightly/20061019_mars_gcc.s10.opt.tarbuild/src/configure --prefix=/opt/gcc --enable-shared --with-system-zlib --enable-checking=release --disable-libmudflap --enable-languages=c,c++ --enable-version-specific-runtime-libs --with-gxx-include-dir=/opt/gcc/include/c++/4.0.3 --with-cpu=v9
Thread model: posix
gcc version 4.0.3 (gccfss)
-bash-3.00$ uname -a
SunOS t1000 5.10 Generic_118833-33 sun4v sparc SUNW,Sun-Fire-T1000 Solaris

论坛徽章:
0
5 [报告]
发表于 2008-06-06 12:25 |只看该作者
我的解决方案:
修改ggpunit.c
238行为extern void *malloc (size_t ln);
241行为extern void *malloc ();
768行为extern void *malloc ();

修改scan_for_matches.c
17行为extern void *malloc ();

我的环境:
$ gcc --version
gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
Linux rocks.local 2.6.9-22.ELsmp #1 SMP Sat Oct 8 19:11:43 CDT 2005 i686 i686 i386 GNU/Linux
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP