I am trying to pass a reference of the applications render window to my image handling class. As you can see
i'm using a const which should not make a copy. However I get this error from gcc.
In file included from /usr/include/SFML/Window.hpp:37:0,
from globals.h:28,
from ImageHandling.h:1,
from ImageHandling.cpp:1:
/usr/include/SFML/System/NonCopyable.hpp: In member function ‘sf::Window& sf::Window::operator=(const sf::Window&)’:
/usr/include/SFML/System/NonCopyable.hpp:64:18: error: ‘sf::NonCopyable& sf::NonCopyable::operator=(const sf::NonCopyable&)’ is private
/usr/include/SFML/Window/Window.hpp:55:16: error: within this context
In file included from /usr/include/SFML/Window.hpp:35:0,
from globals.h:28,
from ImageHandling.h:1,
from ImageHandling.cpp:1:
/usr/include/SFML/System/NonCopyable.hpp: In member function ‘sf::Input& sf::Input::operator=(const sf::Input&)’:
/usr/include/SFML/System/NonCopyable.hpp:64:18: error: ‘sf::NonCopyable& sf::NonCopyable::operator=(const sf::NonCopyable&)’ is private
/usr/include/SFML/Window/Input.hpp:44:16: error: within this context
In file included from /usr/include/SFML/Window.hpp:37:0,
from globals.h:28,
from ImageHandling.h:1,
from ImageHandling.cpp:1:
/usr/include/SFML/Window/Window.hpp: In member function ‘sf::Window& sf::Window::operator=(const sf::Window&)’:
/usr/include/SFML/Window/Window.hpp:55:16: note: synthesized method ‘sf::Input& sf::Input::operator=(const sf::Input&)’ first required here
In file included from /usr/include/SFML/Graphics.hpp:38:0,
from globals.h:29,
from ImageHandling.h:1,
from ImageHandling.cpp:1:
/usr/include/SFML/Graphics/RenderWindow.hpp: In member function ‘sf::RenderWindow& sf::RenderWindow::operator=(const sf::RenderWindow&)’:
/usr/include/SFML/Graphics/RenderWindow.hpp:46:16: note: synthesized method ‘sf::Window& sf::Window::operator=(const sf::Window&)’ first required here
ImageHandling.cpp: In member function ‘void imageHandler::setScreen(const sf::RenderWindow&)’:
ImageHandling.cpp:15:16: note: synthesized method ‘sf::RenderWindow& sf::RenderWindow::operator=(const sf::RenderWindow&)’ first required here
make: *** [ImageHandling.o] Error 1
My code is as follows.
RenderWindow screen;
void imageHandler::setScreen(RenderWindow& screens) {
screen = screens;
}
void imageHandler::surfApp( int x, int y, string imageName )
{
map<string, Sprite>::iterator p = spriteList.find( imageName );
if( p != spriteList.end() )
{
p -> second.SetPosition( x, y );
screen.Draw( p -> second );
}
}