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

Author Topic: sf::Window inheritance [SOLVED]  (Read 1564 times)

0 Members and 1 Guest are viewing this topic.

Andrei15193

  • Guest
sf::Window inheritance [SOLVED]
« on: July 10, 2012, 10:08:15 am »
I've inherited sf::Window in one of my projects, however the compiler gives a bunch of warnings. Also I see sf::NotCopyable class inheritance in the warnings, no virtual destructor. To get to my question, is sf::Window not meant to be inherited?
« Last Edit: July 11, 2012, 08:59:51 am by Andrei15193 »

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: sf::Window inheritance
« Reply #1 on: July 10, 2012, 11:46:42 am »
why do you need it ?

Andrei15193

  • Guest
Re: sf::Window inheritance
« Reply #2 on: July 10, 2012, 11:55:39 am »
Because I need a specialized sf::Window.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::Window inheritance
« Reply #3 on: July 10, 2012, 01:25:44 pm »
Quote
To get to my question, is sf::Window not meant to be inherited?
No, it's just not meant to be copied.
Laurent Gomila - SFML developer

Andrei15193

  • Guest
Re: sf::Window inheritance
« Reply #4 on: July 10, 2012, 04:08:25 pm »
Here is the compiler output mentioned here.

$g++ -W -Weffc++ -Wall -Wsynth -std=c++0x -pedantic-errors -I ~/SFML/include -c *.cpp
In file included from /home/andrei/SFML/include/SFML/System.hpp:36:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from Application.cpp:1:
/home/andrei/SFML/include/SFML/System/Lock.hpp:43:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:37:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from Application.cpp:1:
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning: ‘class sf::Mutex’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning:   but does not override ‘sf::Mutex(const sf::Mutex&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning:   or ‘operator=(const sf::Mutex&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:40:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from Application.cpp:1:
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning: ‘class sf::Thread’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning:   but does not override ‘sf::Thread(const sf::Thread&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning:   or ‘operator=(const sf::Thread&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:41:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from Application.cpp:1:
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning: ‘class sf::ThreadLocal’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning:   but does not override ‘sf::ThreadLocal(const sf::ThreadLocal&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning:   or ‘operator=(const sf::ThreadLocal&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/Window.hpp:33:0,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from Application.cpp:1:
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: base class ‘class sf::GlResource’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: ‘class sf::Context’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning:   but does not override ‘sf::Context(const sf::Context&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning:   or ‘operator=(const sf::Context&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/Window.hpp:40:0,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from Application.cpp:1:
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: base class ‘class sf::GlResource’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: ‘class sf::Window’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning:   but does not override ‘sf::Window(const sf::Window&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning:   or ‘operator=(const sf::Window&)’ [-Weffc++]
Game.cpp:3:6: warning: unused parameter ‘signal’ [-Wunused-parameter]
In file included from /home/andrei/SFML/include/SFML/System.hpp:36:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from GameWindow.cpp:21:
/home/andrei/SFML/include/SFML/System/Lock.hpp:43:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:37:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from GameWindow.cpp:21:
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning: ‘class sf::Mutex’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning:   but does not override ‘sf::Mutex(const sf::Mutex&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning:   or ‘operator=(const sf::Mutex&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:40:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from GameWindow.cpp:21:
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning: ‘class sf::Thread’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning:   but does not override ‘sf::Thread(const sf::Thread&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning:   or ‘operator=(const sf::Thread&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:41:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from GameWindow.cpp:21:
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning: ‘class sf::ThreadLocal’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning:   but does not override ‘sf::ThreadLocal(const sf::ThreadLocal&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning:   or ‘operator=(const sf::ThreadLocal&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/Window.hpp:33:0,
                 from GameWindow.hpp:25,
                 from GameWindow.cpp:21:
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: base class ‘class sf::GlResource’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: ‘class sf::Context’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning:   but does not override ‘sf::Context(const sf::Context&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning:   or ‘operator=(const sf::Context&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/Window.hpp:40:0,
                 from GameWindow.hpp:25,
                 from GameWindow.cpp:21:
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: base class ‘class sf::GlResource’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: ‘class sf::Window’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning:   but does not override ‘sf::Window(const sf::Window&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning:   or ‘operator=(const sf::Window&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:36:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from main.cpp:1:
/home/andrei/SFML/include/SFML/System/Lock.hpp:43:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:37:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from main.cpp:1:
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning: ‘class sf::Mutex’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning:   but does not override ‘sf::Mutex(const sf::Mutex&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/Mutex.hpp:47:23: warning:   or ‘operator=(const sf::Mutex&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:40:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from main.cpp:1:
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning: ‘class sf::Thread’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning:   but does not override ‘sf::Thread(const sf::Thread&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/Thread.hpp:48:23: warning:   or ‘operator=(const sf::Thread&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/System.hpp:41:0,
                 from /home/andrei/SFML/include/SFML/Window.hpp:32,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from main.cpp:1:
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning: ‘class sf::ThreadLocal’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning:   but does not override ‘sf::ThreadLocal(const sf::ThreadLocal&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/System/ThreadLocal.hpp:47:23: warning:   or ‘operator=(const sf::ThreadLocal&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/Window.hpp:33:0,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from main.cpp:1:
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: base class ‘class sf::GlResource’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning: ‘class sf::Context’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning:   but does not override ‘sf::Context(const sf::Context&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Context.hpp:48:23: warning:   or ‘operator=(const sf::Context&)’ [-Weffc++]
In file included from /home/andrei/SFML/include/SFML/Window.hpp:40:0,
                 from GameWindow.hpp:25,
                 from Application.hpp:4,
                 from main.cpp:1:
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: base class ‘class sf::GlResource’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: base class ‘class sf::NonCopyable’ has a non-virtual destructor [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning: ‘class sf::Window’ has pointer data members [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning:   but does not override ‘sf::Window(const sf::Window&)’ [-Weffc++]
/home/andrei/SFML/include/SFML/Window/Window.hpp:57:23: warning:   or ‘operator=(const sf::Window&)’ [-Weffc++]

Hope it's useful

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::Window inheritance
« Reply #5 on: July 10, 2012, 04:25:08 pm »
Oh, ok. Nothing's wrong, you should just disable -Weffc++ if you don't want these warnings to show.
Laurent Gomila - SFML developer

Andrei15193

  • Guest
Re: sf::Window inheritance
« Reply #6 on: July 10, 2012, 04:55:27 pm »
Nah, I'm using that feature for my code.