Hi texus,
I downloaded the latest snapshots of TGUI and SFML on Github and I installed them by running the following commands:
And then I wrote a very simple program, like this:
and I compiled it with
But g++ does not think in that way, and say to me:
As though all methods from base class were not know in children classes, so making overriding tests fail.
The version of g++ is 5.2.1, and I'm on Ubuntu 15.10.
Any idea of why is that happening ?
I downloaded the latest snapshots of TGUI and SFML on Github and I installed them by running the following commands:
Code Select
mkdir build
cd build
cmake ..
make -j2
sudo make install
sudo ldconfig #Just to be sure
And then I wrote a very simple program, like this:
Code Select
#include <TGUI/Label.hpp>
int main(){}
and I compiled it with
Code Select
g++ -std=c++11 -ltgui -lsfml-graphics -lsfml-window -lsfml-system main.cpp
But g++ does not think in that way, and say to me:
Code Select
In file included from /usr/local/include/TGUI/Label.hpp:30:0,
from main.cpp:1:
/usr/local/include/TGUI/ClickableWidget.hpp:90:29: error: ‘virtual tgui::Widget::Ptr tgui::ClickableWidget::clone()’ marked ‘override’, but does not override
virtual Widget::Ptr clone() override
^
In file included from main.cpp:1:0:
/usr/local/include/TGUI/Label.hpp:99:22: error: ‘virtual void tgui::Label::setPosition(const tgui::Layout&)’ marked ‘override’, but does not override
virtual void setPosition(const Layout& position) override;
^
/usr/local/include/TGUI/Label.hpp:118:22: error: ‘virtual void tgui::Label::setSize(const tgui::Layout&)’ marked ‘override’, but does not override
virtual void setSize(const Layout& size) override;
^
/usr/local/include/TGUI/Label.hpp:329:22: error: ‘virtual void tgui::Label::initialize(tgui::Container*)’ marked ‘override’, but does not override
virtual void initialize(Container *const container) override;
^
/usr/local/include/TGUI/Label.hpp:354:22: error: ‘virtual void tgui::Label::update()’ marked ‘override’, but does not override
virtual void update() override;
^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h:33:0,
from /usr/include/c++/5/bits/allocator.h:46,
from /usr/include/c++/5/string:41,
from /usr/local/include/TGUI/Exception.hpp:30,
from /usr/local/include/TGUI/Global.hpp:32,
from /usr/local/include/TGUI/Widget.hpp:30,
from /usr/local/include/TGUI/ClickableWidget.hpp:30,
from /usr/local/include/TGUI/Label.hpp:30,
from main.cpp:1:
/usr/include/c++/5/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = tgui::ClickableWidget; _Args = {tgui::ClickableWidget&}; _Tp = tgui::ClickableWidget]’:
/usr/include/c++/5/bits/alloc_traits.h:256:4: required from ‘static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = tgui::ClickableWidget; _Args = {tgui::ClickableWidget&}; _Alloc = std::allocator<tgui::ClickableWidget>; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]’
/usr/include/c++/5/bits/alloc_traits.h:402:16: required from ‘static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = tgui::ClickableWidget; _Args = {tgui::ClickableWidget&}; _Alloc = std::allocator<tgui::ClickableWidget>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]’
/usr/include/c++/5/bits/shared_ptr_base.h:522:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {tgui::ClickableWidget&}; _Tp = tgui::ClickableWidget; _Alloc = std::allocator<tgui::ClickableWidget>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/5/bits/shared_ptr_base.h:617:4: required from ‘std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = tgui::ClickableWidget; _Alloc = std::allocator<tgui::ClickableWidget>; _Args = {tgui::ClickableWidget&}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/5/bits/shared_ptr_base.h:1097:35: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<tgui::ClickableWidget>; _Args = {tgui::ClickableWidget&}; _Tp = tgui::ClickableWidget; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/5/bits/shared_ptr.h:319:64: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<tgui::ClickableWidget>; _Args = {tgui::ClickableWidget&}; _Tp = tgui::ClickableWidget]’
/usr/include/c++/5/bits/shared_ptr.h:614:39: required from ‘std::shared_ptr<_Tp1> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = tgui::ClickableWidget; _Alloc = std::allocator<tgui::ClickableWidget>; _Args = {tgui::ClickableWidget&}]’
/usr/include/c++/5/bits/shared_ptr.h:629:39: required from ‘std::shared_ptr<_Tp1> std::make_shared(_Args&& ...) [with _Tp = tgui::ClickableWidget; _Args = {tgui::ClickableWidget&}]’
/usr/local/include/TGUI/ClickableWidget.hpp:92:59: required from here
/usr/include/c++/5/ext/new_allocator.h:120:4: error: invalid new-expression of abstract class type ‘tgui::ClickableWidget’
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^
In file included from /usr/local/include/TGUI/Label.hpp:30:0,
from main.cpp:1:
/usr/local/include/TGUI/ClickableWidget.hpp:55:20: note: because the following virtual functions are pure within ‘tgui::ClickableWidget’:
class TGUI_API ClickableWidget : public Widget
^
In file included from /usr/local/include/TGUI/ClickableWidget.hpp:30:0,
from /usr/local/include/TGUI/Label.hpp:30,
from main.cpp:1:
/usr/local/include/TGUI/Widget.hpp:564:29: note: virtual tgui::Widget::Ptr tgui::Widget::clone() const
virtual Widget::Ptr clone() const = 0;
^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h:33:0,
from /usr/include/c++/5/bits/allocator.h:46,
from /usr/include/c++/5/string:41,
from /usr/local/include/TGUI/Exception.hpp:30,
from /usr/local/include/TGUI/Global.hpp:32,
from /usr/local/include/TGUI/Widget.hpp:30,
from /usr/local/include/TGUI/ClickableWidget.hpp:30,
from /usr/local/include/TGUI/Label.hpp:30,
from main.cpp:1:
/usr/include/c++/5/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = tgui::Label; _Args = {tgui::Label&}; _Tp = tgui::Label]’:
/usr/include/c++/5/bits/alloc_traits.h:256:4: required from ‘static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = tgui::Label; _Args = {tgui::Label&}; _Alloc = std::allocator<tgui::Label>; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]’
/usr/include/c++/5/bits/alloc_traits.h:402:16: required from ‘static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = tgui::Label; _Args = {tgui::Label&}; _Alloc = std::allocator<tgui::Label>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]’
/usr/include/c++/5/bits/shared_ptr_base.h:522:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {tgui::Label&}; _Tp = tgui::Label; _Alloc = std::allocator<tgui::Label>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/5/bits/shared_ptr_base.h:617:4: required from ‘std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = tgui::Label; _Alloc = std::allocator<tgui::Label>; _Args = {tgui::Label&}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/5/bits/shared_ptr_base.h:1097:35: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<tgui::Label>; _Args = {tgui::Label&}; _Tp = tgui::Label; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’
/usr/include/c++/5/bits/shared_ptr.h:319:64: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<tgui::Label>; _Args = {tgui::Label&}; _Tp = tgui::Label]’
/usr/include/c++/5/bits/shared_ptr.h:614:39: required from ‘std::shared_ptr<_Tp1> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = tgui::Label; _Alloc = std::allocator<tgui::Label>; _Args = {tgui::Label&}]’
/usr/include/c++/5/bits/shared_ptr.h:629:39: required from ‘std::shared_ptr<_Tp1> std::make_shared(_Args&& ...) [with _Tp = tgui::Label; _Args = {tgui::Label&}]’
/usr/local/include/TGUI/Label.hpp:347:49: required from here
/usr/include/c++/5/ext/new_allocator.h:120:4: error: invalid new-expression of abstract class type ‘tgui::Label’
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^
In file included from main.cpp:1:0:
/usr/local/include/TGUI/Label.hpp:47:20: note: because the following virtual functions are pure within ‘tgui::Label’:
class TGUI_API Label : public ClickableWidget, public WidgetBorders, public WidgetPadding
^
In file included from /usr/local/include/TGUI/ClickableWidget.hpp:30:0,
from /usr/local/include/TGUI/Label.hpp:30,
from main.cpp:1:
/usr/local/include/TGUI/Widget.hpp:564:29: note: virtual tgui::Widget::Ptr tgui::Widget::clone() const
virtual Widget::Ptr clone() const = 0;
^
As though all methods from base class were not know in children classes, so making overriding tests fail.
The version of g++ is 5.2.1, and I'm on Ubuntu 15.10.
Any idea of why is that happening ?