| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1124 人关注过本帖
标题:书上的例子,为什么gcc编译不了?
取消只看楼主 加入收藏
hengde_li
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:131
专家分:178
注 册:2010-1-15
结帖率:91.67%
收藏
已结贴  问题点数:20 回复次数:6 
书上的例子,为什么gcc编译不了?
这是徐士良书上的例子,见附件,怎么gcc编译不成功?求助各位。
2015-09-09 15:00
hengde_li
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:131
专家分:178
注 册:2010-1-15
收藏
得分:0 
12CPLX0.rar (1.81 KB)

编译后提示:12CPLX0.C:4:16: error: 'x' was not declared in this scope
12CPLX0.C:4:18: error: 'n' was not declared in this scope
12CPLX0.C:4:19: error: expression list treated as compound expression in initializer [-fpermissive]
12CPLX0.C:5:3: error: expected ',' or ';' before 'int'
12CPLX0.C:6:11: error: expected initializer before '*' token
12CPLX0.C:7:3: error: expected unqualified-id before '{' token
12CPLX0.C:15:14: error: variable or field 'cplxs' declared void
12CPLX0.C:15:14: error: 'n' was not declared in this scope
12CPLX0.C:15:16: error: 'm' was not declared in this scope
12CPLX0.C:15:18: error: 'x' was not declared in this scope
12CPLX0.C:15:20: error: 'c' was not declared in this scope
12CPLX0.C:15:22: error: 'd' was not declared in this scope
12CPLX0.C:15:24: error: 'w' was not declared in this scope
12CPLX0.C:18:3: error: expected unqualified-id before '{' token
12CPLX0.C:25:2: error: expected unqualified-id before '{' token
12CPLX0.C: In function 'int cplx(int, int, double*, double*, double, double, double*, double*, int, void (*)(int, int, double*, double*, double*, double*), double (*)(d
ble*, int))':
12CPLX0.C:48:30: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:49:30: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:50:30: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:51:31: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:52:31: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C: In function 'int main()':
12CPLX0.C:178:50: error: cannot convert 'double (*)[4]' to 'double*' for argument '8' to 'int cplx(int, int, double*, double*, double, double, double*, double*, int, vo
 (*)(int, int, double*, double*, double*, double*), double (*)(double*, int))'
2015-09-09 15:03
hengde_li
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:131
专家分:178
注 册:2010-1-15
收藏
得分:0 
12CPLX0.rar (1.83 KB)

刚才复制是落了一句话,重新附上。编译后错误:
12CPLX0.C: In function 'int cplx(int, int, double*, double*, double, double, double*, double*, int, void (*)(int, int, double*, double*, double*, double*), double (*)(dou
ble*, int))':
12CPLX0.C:46:30: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:47:30: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:48:30: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:49:31: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C:50:31: error: invalid conversion from 'void*' to 'double*' [-fpermissive]
12CPLX0.C: In function 'int main()':
12CPLX0.C:176:50: error: cannot convert 'double (*)[4]' to 'double*' for argument '8' to 'int cplx(int, int, double*, double*, double, double, double*, double*, int, void
 (*)(int, int, double*, double*, double*, double*), double (*)(double*, int))'
2015-09-09 15:07
hengde_li
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:131
专家分:178
注 册:2010-1-15
收藏
得分:0 
回复 5楼 zklhp
这都是书上的,没有改
2015-09-10 08:38
hengde_li
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:131
专家分:178
注 册:2010-1-15
收藏
得分:0 
除了吐槽还是吐槽
2015-09-10 10:22
hengde_li
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:131
专家分:178
注 册:2010-1-15
收藏
得分:0 
回复 11楼 jklqwe111
感谢不吐槽的侠客,基本解决了问题。谢谢!
论坛需要你这样的人!!!
2015-09-10 10:36
hengde_li
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:131
专家分:178
注 册:2010-1-15
收藏
得分:0 
回复 11楼 jklqwe111
剩下的是算法上的小细节,仔细扣扣能搞定,谢谢!
2015-09-10 10:40
快速回复:书上的例子,为什么gcc编译不了?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016729 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved