Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RenderTexture, compile fail on linux gcc  (Read 2612 times)

0 Members and 1 Guest are viewing this topic.

93interactive

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • http://93-interactive.com
RenderTexture, compile fail on linux gcc
« on: October 27, 2012, 12:21:16 pm »
Hi there, i am trying to user RenderTexture, but as soon as i include it as simple as this in my class:

Code: [Select]
class MyClass {
   private:
      sf::RenderTexture tex;
};

I get a compile error:

(SFML 2 current git clone, linuxmint and debian, gcc 4.6.3)

Code: [Select]
In file included from ../SFML/include/SFML/Graphics/RenderTexture.hpp:33:0,
                 from ../SFML/include/SFML/Graphics.hpp:39,
                 from include/hexgrid.h:8,
                 from src/hexgrid.cpp:1:
../SFML/include/SFML/System/NonCopyable.hpp: In copy constructor ‘sf::RenderTarget::RenderTarget(const sf::RenderTarget&)’:
../SFML/include/SFML/Graphics/RenderTarget.hpp:51:25:   instantiated from ‘void __gnu_cxx::new_allocator<_Tp>::construct(__gnu_cxx::new_allocator<_Tp>::pointer, const _Tp&) [with _Tp = HexField, __gnu_cxx::new_allocator<_Tp>::pointer = HexField*]’
/usr/include/c++/4.6/bits/stl_vector.h:830:6:   instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = HexField, _Alloc = std::allocator<HexField>, std::vector<_Tp, _Alloc>::value_type = HexField]’
src/hexgrid.cpp:55:29:   instantiated from here
../SFML/include/SFML/System/NonCopyable.hpp:67:5: error: ‘sf::NonCopyable::NonCopyable(const sf::NonCopyable&)’ is private
../SFML/include/SFML/Graphics/RenderTarget.hpp:51:25: error: within this context
In file included from ../SFML/include/SFML/Graphics.hpp:39:0,
                 from include/hexgrid.h:8,
                 from src/hexgrid.cpp:1:
../SFML/include/SFML/Graphics/RenderTexture.hpp: In copy constructor ‘sf::RenderTexture::RenderTexture(const sf::RenderTexture&)’:
../SFML/include/SFML/Graphics/RenderTexture.hpp:47:25: note: synthesized method ‘sf::RenderTarget::RenderTarget(const sf::RenderTarget&)’ first required here
In file included from include/hexfield.h:12:0,
                 from include/hexgrid.h:14,
                 from src/hexgrid.cpp:1:
include/tilerenderer.h: In copy constructor ‘TileRenderer::TileRenderer(const TileRenderer&)’:
include/tilerenderer.h:11:7: note: synthesized method ‘sf::RenderTexture::RenderTexture(const sf::RenderTexture&)’ first required here
In file included from include/hexgrid.h:14:0,
                 from src/hexgrid.cpp:1:
include/hexfield.h: In copy constructor ‘HexField::HexField(const HexField&)’:
include/hexfield.h:15:7: note: synthesized method ‘TileRenderer::TileRenderer(const TileRenderer&)’ first required here
In file included from /usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++allocator.h:34:0,
                 from /usr/include/c++/4.6/bits/allocator.h:48,
                 from /usr/include/c++/4.6/string:43,
                 from /usr/include/c++/4.6/bits/locale_classes.h:42,
                 from /usr/include/c++/4.6/bits/ios_base.h:43,
                 from /usr/include/c++/4.6/ios:43,
                 from /usr/include/c++/4.6/ostream:40,
                 from /usr/include/c++/4.6/iostream:40,
                 from include/hexgrid.h:4,
                 from src/hexgrid.cpp:1:
/usr/include/c++/4.6/ext/new_allocator.h: In member function ‘void __gnu_cxx::new_allocator<_Tp>::construct(__gnu_cxx::new_allocator<_Tp>::pointer, const _Tp&) [with _Tp = HexField, __gnu_cxx::new_allocator<_Tp>::pointer = HexField*]’:
/usr/include/c++/4.6/ext/new_allocator.h:108:9: note: synthesized method ‘HexField::HexField(const HexField&)’ first required here
In file included from ../SFML/include/SFML/Graphics/RenderTexture.hpp:33:0,
                 from ../SFML/include/SFML/Graphics.hpp:39,
../SFML/include/SFML/System/NonCopyable.hpp: In member function ‘sf::RenderTarget& sf::RenderTarget::operator=(const sf::RenderTarget&)’:
../SFML/include/SFML/Graphics/RenderTarget.hpp:51:25:   instantiated from ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = HexField, _Alloc = std::allocator<HexField>, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<HexField*, std::vector<HexField> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = HexField*]’
/usr/include/c++/4.6/bits/stl_vector.h:834:4:   instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = HexField, _Alloc = std::allocator<HexField>, std::vector<_Tp, _Alloc>::value_type = HexField]’
src/hexgrid.cpp:55:29:   instantiated from here
../SFML/include/SFML/System/NonCopyable.hpp:79:18: error: ‘sf::NonCopyable& sf::NonCopyable::operator=(const sf::NonCopyable&)’ is private
../SFML/include/SFML/Graphics/RenderTarget.hpp:51:25: error: within this context
In file included from ../SFML/include/SFML/Graphics.hpp:39:0,
                 from include/hexgrid.h:8,
                 from src/hexgrid.cpp:1:
../SFML/include/SFML/Graphics/RenderTexture.hpp: In member function ‘sf::RenderTexture& sf::RenderTexture::operator=(const sf::RenderTexture&)’:
../SFML/include/SFML/Graphics/RenderTexture.hpp:47:25: note: synthesized method ‘sf::RenderTarget& sf::RenderTarget::operator=(const sf::RenderTarget&)’ first required here
In file included from include/hexfield.h:12:0,
                 from include/hexgrid.h:14,
                 from src/hexgrid.cpp:1:
include/tilerenderer.h: In member function ‘TileRenderer& TileRenderer::operator=(const TileRenderer&)’:
include/tilerenderer.h:11:7: note: synthesized method ‘sf::RenderTexture& sf::RenderTexture::operator=(const sf::RenderTexture&)’ first required here
In file included from include/hexgrid.h:14:0,
                 from src/hexgrid.cpp:1:
include/hexfield.h: In member function ‘HexField& HexField::operator=(const HexField&)’:
include/hexfield.h:15:7: note: synthesized method ‘TileRenderer& TileRenderer::operator=(const TileRenderer&)’ first required here
In file included from /usr/include/c++/4.6/vector:70:0,
                 from include/hexgrid.h:5,
                 from src/hexgrid.cpp:1:
/usr/include/c++/4.6/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, const _Tp&) [with _Tp = HexField, _Alloc = std::allocator<HexField>, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<HexField*, std::vector<HexField> >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = HexField*]’:
/usr/include/c++/4.6/bits/vector.tcc:317:4: note: synthesized method ‘HexField& HexField::operator=(const HexField&)’ first required here

Marukyu

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: RenderTexture, compile fail on linux gcc
« Reply #1 on: October 27, 2012, 12:57:57 pm »
sf::RenderTexture cannot be copied, so classes that use it as a member cannot be used within containers such as std::vector directly. A vector of pointers to said class will work, though.

 

anything