copy / ostream_iterator中的标准问题 [英] Problem with standard in copy/ostream_iterator

查看:56
本文介绍了copy / ostream_iterator中的标准问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

当我编译这段代码时,我收到以下错误:

" NewShapes.cpp:在函数`int main()''中:

NewShapes.cpp:12:错误:`ShapePtr''不能出现在常量表达式中

NewShapes.cpp:12:错误:模板参数1无效

NewShapes.cpp:12:错误:模板参数2无效


我可能会更改所有代码,但不会更改main中的代码(对不起),我可以添加代码到主要但不改变它。

NewShapes.cpp

Hi !
When I compile this piece of code I get the following error:
"NewShapes.cpp: In function `int main()'':
NewShapes.cpp:12: error: `ShapePtr'' cannot appear in a constant-expression
NewShapes.cpp:12: error: template argument 1 is invalid
NewShapes.cpp:12: error: template argument 2 is invalid"

I may change all code but not change the code in main (sorry), I may add code to the main but not change it.

NewShapes.cpp:

展开 | 选择 | Wrap | 行号

推荐答案

错误消息突出显示问题
展开 | 选择 | Wrap | 行号


另外,你没有#include .cpp文件。


你所做的是将.cpp文件添加到项目中。每个.cpp文件必须单独编译。 makefile负责编译每个.cpp文件。


通过#including .cpp文件,每次编译时都会复制代码。在某些时候youo将开始获取重新定义错误,你的构建将停止工作。
Also, you do not #include .cpp files.

What you do is ADD .cpp files to your project. Each .cpp file must be compiled separately. The makefile takes care of compiling each .cpp file.

By #including .cpp files, you duplicate the code each time you compile. AT some point youo will start gettingr redefinition errors and your builds will stop working.


谢谢你的提示。

Manfa,你的意思是:" vector< const ShapePtr> shapevec" ;?这不起作用......

弱点,所有CPP编译:只有两个,其他标题有内联代码。


问题仍然存在.. Plaese帮忙......


Adalte。
Thank you for hints.
Manfa, you mean: "vector<const ShapePtr> shapevec"? Thats not work ...
weaknessforcats, all CPP compiles: there are just two, the others headers has inline code.

The problem still there ... Plaese help ...

Adalte.


这篇关于copy / ostream_iterator中的标准问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆