I'm working through the SFML game dev book, and it's pretty great. However, when coding along to the chapter
22:31:46: Starting: "/usr/bin/make"
g++ -c -pipe -std=c++11 -Wall -Wextra -g -Wall -W -DQT_WEBKIT -I/usr/share/qt4/mkspecs/linux-g++ -I../SFMLbook -I../SFMLbook -I. -o world.o ../SFMLbook/world.cpp
In file included from /usr/include/c++/4.8/set:60:0,
from ../SFMLbook/scenenode.hpp:13,
from ../SFMLbook/entity.hpp:4,
from ../SFMLbook/aircraft.hpp:4,
from ../SFMLbook/world.hpp:4,
from ../SFMLbook/world.cpp:1:
/usr/include/c++/4.8/bits/stl_tree.h: In instantiation of 'std::_Rb_tree_node<_Val>::_Rb_tree_node(_Args&& ...) [with _Args = {const std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >&}; _Val = std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >]':
/usr/include/c++/4.8/ext/new_allocator.h:120:4: required from 'void __gnu_cxx::new_allocator< <template-parameter-1-1> >::construct(_Up*, _Args&& ...) [with _Up = std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; _Args = {const std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >&}; _Tp = std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >]'
/usr/include/c++/4.8/bits/alloc_traits.h:254:4: required from 'static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; _Args = {const std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >&}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > > >; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]'
/usr/include/c++/4.8/bits/alloc_traits.h:393:57: 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 = std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; _Args = {const std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >&}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > > >; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
/usr/include/c++/4.8/bits/stl_tree.h:408:36: required from 'std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >&}; _Key = Fonts::ID; _Val = std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >; _KeyOfValue = std::_Select1st<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; _Compare = std::less<Fonts::ID>; _Alloc = std::allocator<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >*]'
/usr/include/c++/4.8/bits/stl_tree.h:429:55: required from 'std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_clone_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type) [with _Key = Fonts::ID; _Val = std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >; _KeyOfValue = std::_Select1st<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; _Compare = std::less<Fonts::ID>; _Alloc = std::allocator<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >*; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >*]'
/usr/include/c++/4.8/bits/stl_tree.h:1087:43: required from 'std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_copy(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = Fonts::ID; _Val = std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >; _KeyOfValue = std::_Select1st<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; _Compare = std::less<Fonts::ID>; _Alloc = std::allocator<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >*; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >*]'
/usr/include/c++/4.8/bits/stl_tree.h:659:50: required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Rb_tree(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&) [with _Key = Fonts::ID; _Val = std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > >; _KeyOfValue = std::_Select1st<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >; _Compare = std::less<Fonts::ID>; _Alloc = std::allocator<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >]'
/usr/include/c++/4.8/bits/stl_map.h:181:22: required from 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = Fonts::ID; _Tp = std::unique_ptr<sf::Font, std::default_delete<sf::Font> >; _Compare = std::less<Fonts::ID>; _Alloc = std::allocator<std::pair<const Fonts::ID, std::unique_ptr<sf::Font, std::default_delete<sf::Font> > > >]'
../SFMLbook/resourceholder.hpp:11:7: required from here
/usr/include/c++/4.8/bits/stl_tree.h:140:49: error: use of deleted function 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const Fonts::ID; _T2 = std::unique_ptr<sf::Font, std::default_delete<sf::Font> >]'
_M_value_field(std::forward<_Args>(__args)...) { }
^
In file included from /usr/include/c++/4.8/utility:70:0,
from /usr/include/c++/4.8/algorithm:60,
from /usr/local/include/SFML/Graphics/Rect.hpp:32,
from /usr/local/include/SFML/Graphics/Transform.hpp:32,
from /usr/local/include/SFML/Graphics/Transformable.hpp:32,
from ../SFMLbook/scenenode.hpp:6,
from ../SFMLbook/entity.hpp:4,
from ../SFMLbook/aircraft.hpp:4,
from ../SFMLbook/world.hpp:4,
from ../SFMLbook/world.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:127:17: note: 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const Fonts::ID; _T2 = std::unique_ptr<sf::Font, std::default_delete<sf::Font> >]' is implicitly deleted because the default definition would be ill-formed:
constexpr pair(const pair&) = default;
^
/usr/include/c++/4.8/bits/stl_pair.h:127:17: error: use of deleted function 'std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = sf::Font; _Dp = std::default_delete<sf::Font>]'
In file included from /usr/include/c++/4.8/memory:81:0,
from ../SFMLbook/scenenode.hpp:11,
from ../SFMLbook/entity.hpp:4,
from ../SFMLbook/aircraft.hpp:4,
from ../SFMLbook/world.hpp:4,
from ../SFMLbook/world.cpp:1:
/usr/include/c++/4.8/bits/unique_ptr.h:273:7: error: declared here
unique_ptr(const unique_ptr&) = delete;
^
make: *** [world.o] Error 1
22:31:47: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project SFMLbook (kit: Desktop)
When executing step 'Make'
I've been going over my code and comparing it to the functioning source from the LaurentGomila GitHub page, but I'm just unable to find any difference in my own code.
So from what I can tell this has something to do with std::set, but it's difficult for me to figure out anything else than that, because this traceback message doesn't actually seem to explicitly show where the problem is in my source, but points to a standard library file instead. Following the error through the files ends up at the class declaration of ResourceHolder before going into stl_tree.h.
So please help me figure out what may be causing this error.
As an aside, here are some personal remarks not directly related to the issue: I'm using the book as a code along and intro to my first real C++ project. Having learnt programming in python, the transition to C++ was shocking in several ways, mostly due to the extreme complexity of the language and how frequently I must go digging for answers to things which were more or less intuitive in python. I don't have any inherent problem with complexity itself, because this technical kind of problem solving is part of why I enjoy programming so much. However, I do consider C++ a pretty awful language by modern standards, because the nature of it's complexity is that of baggage from decades ago, and implementing too many paradigms to be a good choice for anyone starting out these days.
Well, maybe people feel differently if they are given a formal education starting with C or Java, and can then proceed to view C++ as an improved or more powerful version of what they already knew, but I don't know if that's true.
I will stick with it until I have a solid understanding of `programming in C++` and feel that I'm comfortable using it to start any kind of project. I want to become a programmer and a game dev, so I think having a working knowledge of all the big daddy languages is a must, but I sure do hope I'll be able to code my own games in a more elegant and modern language than this.