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

Author Topic: Noncopyable Error  (Read 1811 times)

0 Members and 1 Guest are viewing this topic.

Paki Programmer

  • Newbie
  • *
  • Posts: 31
    • View Profile
Noncopyable Error
« on: January 26, 2012, 11:22:45 pm »
Ive looked around on other forums and this one and i think im certain that im trying to copy the sf::RenderWindow window that i made for my game engine...and according to what i've found that's not possible. I suppose i have to make a pointer to the window or a reference but since im still fairly rusty with programming (haven't used C++ for a while) i dont know how to go about doing this. Here are the two parts of my code i think are causing the trouble. Any idea how i can go about creating a reference or pointer to the render window ?


Code: [Select]

sf::RenderWindow System::SetWindow(int width, int height, std::string title)
{
sf::RenderWindow *ref = new sf::RenderWindow();
sf::RenderWindow w(sf::VideoMode(width, height), title.c_str());

ref = &w;

return *ref;
}


Code: [Select]

void System::Init()
{
engine = new System();
window = new sf::RenderWindow();

engine -> window = &engine -> SetWindow(800, 600, "Test");
}


And also here is the error i keep getting:

    Error   1   error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'   c:\program files\sfml 2.0\include\sfml\window\window.hpp   479


    Error   2   error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'   c:\program files\sfml 2.0\include\sfml\graphics\rendertarget.hpp   304


Paki Programmer

  • Newbie
  • *
  • Posts: 31
    • View Profile
Noncopyable Error
« Reply #1 on: January 26, 2012, 11:36:59 pm »
never mind guys i managed to fix it :)

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Noncopyable Error
« Reply #2 on: January 27, 2012, 04:02:46 am »
Can you give an explanation of your fix for future users who might find this topic?