| 查看: 701 | 回复: 4 | ||
[求助]
为何编不过?哪里错了?
|
|
#include template template class CSampleTemplate { private: T t1; T2 t2; public: CSampleTemplace(T arg1, T2 arg2) { t1=arg1+num; t2=arg2+num; } void Write() { std::cout<<"t1:"< ~ CSampleTemmplate(void){} }; int main(int argc, char* argv[]) { CSampleTemplate temp.Write(); return 0; } 编辑错误为:ug-------------------- Compiling... 11.cpp E:\1\11.cpp(2) : error C2991: redefinition of template parameter '__formal' E:\1\11.cpp(2) : see declaration of '__formal' E:\1\11.cpp(2) : error C2059: syntax error : 'constant' E:\1\11.cpp(2) : error C2501: 'demol' : missing storage-class or type specifiers E:\1\11.cpp(14) : warning C4183: 'CSampleTemplace': member function definition looks like a ctor, but name does not match enclosing class E:\1\11.cpp(20) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(19) : error C2523: 'CSampleTemplate E:\1\11.cpp(20) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(11) : warning C4183: 'CSampleTemplace': member function definition looks like a ctor, but name does not match enclosing class E:\1\11.cpp(23) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(19) : error C2523: 'CSampleTemplate E:\1\11.cpp(23) : see reference to class template instantiation 'CSampleTemplate E:\1\11.cpp(23) : error C2661: 'CSampleTemplate Error executing cl.exe. 11.obj - 6 error(s), 2 warning(s) |
» 猜你喜欢
不自信的我
已经有6人回复
磺酰氟产物,毕不了业了!
已经有8人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有10人回复
26申博(荧光探针方向,有机合成)
已经有4人回复
要不要辞职读博?
已经有3人回复
论文终于录用啦!满足毕业条件了
已经有26人回复
2026年机械制造与材料应用国际会议 (ICMMMA 2026)
已经有4人回复
Cas 72-43-5需要30g,定制合成,能接单的留言
已经有8人回复
北京211副教授,35岁,想重新出发,去国外做博后,怎么样?
已经有8人回复
自荐读博
已经有3人回复
» 本主题相关价值贴推荐,对您同样有帮助:
《化学学报》投稿模板编辑出错
已经有3人回复
C++编程,关于循环结构的,大家看看我这程序哪里错了?
已经有21人回复
要是已经发表的SCI论文发现有重大的错误怎么办?错误是编辑造成的不死我造成的
已经有5人回复
原来编译的siesta突然不能用,重新编译没错,运行出错
已经有13人回复
编译vasp出错
已经有11人回复
【求助】f90子程序怎么编译错误?请大家帮忙,谢谢
已经有3人回复
投稿两天发现稿子有个错误,编辑也指出来了,怎么办?
已经有21人回复
编辑发错审稿意见,但文章无进展,如何处理
已经有9人回复
编辑发错审稿意见了如何写信询问
已经有15人回复
编辑来信,我把来信翻译了 大家帮看看哪有错误?
已经有15人回复
【求助】SAS编程出了错,看不懂,请教高手
已经有8人回复
caoyjian
金虫 (小有名气)
- 应助: 1 (幼儿园)
- 金币: 2047.2
- 帖子: 181
- 在线: 68.8小时
- 虫号: 1677947
- 注册: 2012-03-09
- 性别: GG
- 专业: 信号理论与信号处理

2楼2012-06-20 11:15:08
caoyjian
金虫 (小有名气)
- 应助: 1 (幼儿园)
- 金币: 2047.2
- 帖子: 181
- 在线: 68.8小时
- 虫号: 1677947
- 注册: 2012-03-09
- 性别: GG
- 专业: 信号理论与信号处理

3楼2012-06-20 11:43:58
|
4楼2012-06-20 12:16:21
5楼2012-06-21 08:51:19












回复此楼