Jump to content
Forgot your email address? ×
×
×
  • Create New...
  • 0

Boost 1.5.8 issue


Galet

Question

  • Premium

Hello,

 

I've got lots of bugs in my old VM machine so I decided to create a new one.

 

My game and db doesn't have any issue about compiling in BOOST 1.55, but in 1.5.7 or highter, only my db can compile. (Before, both db and game are using boost 1.5.7 without problem)

 

Here's the bug when i'm using 1.5.8 (at char_skill.cpp)

 

LprpsPZ.png

 

Text mode :

/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:193:24: note:   template argument deduction/substitution failed:
In file included from /usr/src/blabla/Extern/include/boost/functional/hash/hash.hpp:558:0,
                 from /usr/src/blabla/Extern/include/boost/functional/hash.hpp:6,
                 from /usr/src/blabla/Extern/include/boost/unordered/unordered_map.hpp:21,
                 from /usr/src/blabla/Extern/include/boost/unordered_map.hpp:17,
                 from char.h:4,
                 from char_skill.cpp:7:
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:262:34: note:   'const VID' is not derived from 'const std::shared_ptr<_Tp1>'
             return hash_value(val);
                                  ^
In file included from /usr/src/blabla/Extern/include/boost/functional/hash/hash.hpp:558:0,
                 from /usr/src/blabla/Extern/include/boost/functional/hash.hpp:6,
                 from /usr/src/blabla/Extern/include/boost/unordered/unordered_map.hpp:21,
                 from /usr/src/blabla/Extern/include/boost/unordered_map.hpp:17,
                 from char.h:4,
                 from char_skill.cpp:7:
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:198:24: note: template<class T, class Deleter> std::size_t boost::hash_value(const std::unique_ptr<_Tp, _Dp>&)
     inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) {
                        ^
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:198:24: note:   template argument deduction/substitution failed:
In file included from /usr/src/blabla/Extern/include/boost/functional/hash/hash.hpp:558:0,
                 from /usr/src/blabla/Extern/include/boost/functional/hash.hpp:6,
                 from /usr/src/blabla/Extern/include/boost/unordered/unordered_map.hpp:21,
                 from /usr/src/blabla/Extern/include/boost/unordered_map.hpp:17,
                 from char.h:4,
                 from char_skill.cpp:7:
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:262:34: note:   'const VID' is not derived from 'const std::unique_ptr<_Tp, _Dp>'
             return hash_value(val);
                                  ^
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp: In member function 'std::size_t boost::hash<T>::operator()(const T&) const [with T = VID; std::size_t = unsigned int]':
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:263:9: warning: control reaches end of non-void function [-Wreturn-type]
         }
         ^
gmake: *** [OBJDIR/char_skill.o] Error 1

I don't know why I have this problem :x

 

PS : If anyone know how to install boost-all (1.5.7 or +) using freebsd ^^

 

Have a nice day :)

Link to comment
  • Answers 6
  • Created
  • Last Reply

Top Posters For This Question

6 answers to this question

Recommended Posts

  • 0

From what I see the problem comes from char_skill:   boost::unordered_map<VID, size_t>::iterator iterTargetMap = rSkillUseInfo.TargetVIDMap.find(TargetVID);
 Inseated of iterators you should use auto.

 

 

 

By looking at the error, it looks like you have to define a hash function for the type VID to be able to use it as a key in a map.

Standard hash functions are already defined in the STL for basic types, but you have to define for yourself a specific one for your domain types.

Usually, it's enough to do something like this:

namespace std {
    template<> struct hash<VID> {
        using argument_type = VID;
        using result_type = std::size_t;

        result_type operator()(argument_type const& vid) const {
            // what to put here depends on the type of VID
            // and how you want to create the hash
        }
    };
}

 

 

The difficulties are usually in understanding how to create the hash. In my experience, for user defined classes, I've ever used the standard specialization with some data members, the most significant ones.

In your case, as an example, you could cast the DWORDs to a couple of unsigned ints and use them to get the hash by using std::hash<unsigned int> (I'm assuming that that's the DWORD from the FreeBSD API, that is a 32 bit unsigned integer as far as I remember).

http://en.cppreference.com/w/cpp/utility/hash

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.