Bug notification at compilation
« on: 04 January 2014, 19:07:33 »
Hello, I'm new at TGUI, compiling tgui on my mac gave me this awful error from Callback.cpp:43 :

Quote
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:234:73: error:
      no matching constructor for initialization of
      'std::__1::reference_wrapper<tgui::Callback>'
             _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
                                                                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:447:23: note:
      in instantiation of member function 'std::__1::__tuple_leaf<0,
      std::__1::reference_wrapper<tgui::Callback>, false>::__tuple_leaf'
      requested here
    _LIBCPP_CONSTEXPR __tuple_impl()
                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:550:23: note:
      in instantiation of member function
      'std::__1::__tuple_impl<std::__1::__tuple_indices<0>,
      std::__1::reference_wrapper<tgui::Callback> >::__tuple_impl' requested
      here
    _LIBCPP_CONSTEXPR tuple()
                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1744:11: note:
      in instantiation of member function
      'std::__1::tuple<std::__1::reference_wrapper<tgui::Callback> >::tuple'
      requested here
          __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2243:15: note:
      in instantiation of function template specialization
      'std::__1::__bind<std::__1::function<void (const tgui::Callback &)> &,
      std::__1::reference_wrapper<tgui::Callback>
      &>::__bind<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &>, , void>' requested here
              __first_(_VSTD::forward<_Args1>(get<_I1>(__first_args))...)
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2421:15: note:
      in instantiation of function template specialization
      'std::__1::__libcpp_compressed_pair_imp<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &>, std::__1::allocator<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &> >,
      2>::__libcpp_compressed_pair_imp<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &> &&, , 0, >' requested here
            : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:992:11: note:
      in instantiation of function template specialization
      'std::__1::__compressed_pair<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &>, std::__1::allocator<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &> > >::__compressed_pair<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &> &&, >' requested here
        : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)),
          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/functional:1277:26: note:
      in instantiation of member function
      'std::__1::__function::__func<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &>, std::__1::allocator<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &> >, void ()>::__func' requested here
            ::new (__f_) _FF(_VSTD::move(__f));
                         ^
/Users/tristansterin/Downloads/TGUI-0.6-RC - GCC 4.7 TDM (SJLJ) - 32 bits/src/TGUI/Callback.cpp:44:21: note:
      in instantiation of function template specialization
      'std::__1::function<void
      ()>::function<std::__1::__bind<std::__1::function<void
      (const tgui::Callback &)> &, std::__1::reference_wrapper<tgui::Callback>
      &> >' requested here
        mapCallback(std::bind(func, a), trigger);
                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_base:365:31: note:
      candidate constructor not viable: requires single argument '__f', but no
      arguments were provided
    _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : _...
                              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_base:367:14: note:
      candidate constructor not viable: requires 1 argument, but 0 were provided
    private: reference_wrapper(type&&); public: // = delete; // do not b...
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_base:354:24: note:
      candidate constructor (the implicit copy constructor) not viable: requires
      1 argument, but 0 were provided
class _LIBCPP_TYPE_VIS reference_wrapper
                       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__functional_base:354:24: note:
      candidate constructor (the implicit move constructor) not viable: requires
      1 argument, but 0 were provided
1 error generated.

This line was a problem :
Code: [Select]
mapCallback(std::bind(func, std::ref(m_Callback)), trigger);I'm not good enough in cpp to understand the real problem, I got that the problem was from the std::ref, I did this (I'm sure it's wrong) :
Code: [Select]
mapCallback(std::bind(func, m_Callback), trigger);
And it all compile perfectly.
How this error could be well corrected ?


*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Bug notification at compilation
« Reply #1 on: 04 January 2014, 19:25:20 »
Could you try changing the std::ref to std::cref and see it the error still occurs?

I hope that it can get solved like that, because I really don't have much time right now (I have exams this month).

Re: Bug notification at compilation
« Reply #2 on: 04 January 2014, 19:30:44 »
I tried putting a cref, it gives me the same error.
Don't worry for me there is no rush, I've got exams too ahah

Re: Bug notification at compilation
« Reply #3 on: 04 January 2014, 19:32:17 »
I'm not using gcc by the way but  LLVM version 5.0 (clang-500.2.79).

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Bug notification at compilation
« Reply #4 on: 05 January 2014, 09:46:50 »