alecthomas / entityx

EntityX - A fast, type-safe C++ Entity-Component system
MIT License
2.23k stars 295 forks source link

example error C2280 'Renderable::Renderable(const Renderable &)': attempting to reference a deleted function VS 2015 #162

Closed Clavotro closed 8 years ago

Clavotro commented 8 years ago

When building the example under Visual Studio 2015 I receive this error. Compiler output:

1>d:\c++\entityx-master\entityx-master\entityx\entity.h(645): error C2280: 'Renderable::Renderable(const Renderable &)': attempting to reference a deleted function 1> d:\c++\entityx-master\entityx-master\examples\example.cc(56): note: compiler has generated 'Renderable::Renderable' here 1> d:\c++\entityx-master\entityx-master\entityx\entity.h(952): note: see reference to function template instantiation 'entityx::ComponentHandle<Renderable,entityx::EntityManager> entityx::EntityManager::assign<C,const C&>(entityx::Entity::Id,const C &)' being compiled 1> with 1> [ 1> C=Renderable 1> ] 1> d:\c++\entityx-master\entityx-master\entityx\entity.h(350): note: see reference to function template instantiation 'entityx::ComponentHandle<Renderable,entityx::EntityManager> entityx::Entity::assign_from_copy<C>(const C &)' being compiled 1> with 1> [ 1> C=Renderable 1> ] 1> d:\c++\entityx-master\entityx-master\entityx\entity.h(349): note: while compiling class template member function 'void entityx::ComponentHelper<C>::copy_component_to(entityx::Entity,entityx::Entity)' 1> with 1> [ 1> C=Renderable 1> ] 1> d:\c++\entityx-master\entityx-master\entityx\entity.h(910): note: see reference to class template instantiation 'entityx::ComponentHelper<C>' being compiled 1> with 1> [ 1> C=Renderable 1> ] 1> d:\c++\entityx-master\entityx-master\entityx\entity.h(644): note: see reference to function template instantiation 'entityx::Pool<C,8192> *entityx::EntityManager::accomodate_component<C>(void)' being compiled 1> with 1> [ 1> C=Renderable 1> ] 1> d:\c++\entityx-master\entityx-master\entityx\entity.h(946): note: see reference to function template instantiation 'entityx::ComponentHandle<Renderable,entityx::EntityManager> entityx::EntityManager::assign<C,_Ty>(entityx::Entity::Id,_Ty &&)' being compiled 1> with 1> [ 1> C=Renderable, 1> _Ty=std::unique_ptr<sf::Shape,std::default_delete<sf::Shape>> 1> ] 1> d:\c++\entityx-master\entityx-master\examples\example.cc(107): note: see reference to function template instantiation 'entityx::ComponentHandle<Renderable,entityx::EntityManager> entityx::Entity::assign<Renderable,std::unique_ptr<sf::Shape,std::default_delete<_Ty>>>(std::unique_ptr<_Ty,std::default_delete<_Ty>> &&)' being compiled 1> with 1> [ 1> _Ty=sf::Shape 1> ]

alecthomas commented 8 years ago

Do you have all of the updates installed? Stock 2015 does not work AFAIK.

Clavotro commented 8 years ago

Hi Alec,

I installed Update 3 (had update 2 already) but am receiving the same error.

Thanks

alecthomas commented 8 years ago

Okay, well that sucks, but I can't really help you. I don't have VS installed. You'll have to debug it yourself.

Clavotro commented 8 years ago

I changed the sf::Shape to a raw pointer and it works... from some googling it may be something to do with newer compilers enforcing std::unique_ptr rules...