Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
Joined: Nov 1999
Posts: 676
Likes: 1
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 676
Likes: 1
Now that MAME 0.213 is out, it is time for BletchMAME to go 1.0:

http://bletchmame.s3-website-us-east-1.amazonaws.com/

Joined: Mar 2001
Posts: 16,679
Likes: 4
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,679
Likes: 4
I'm trying to compile BletchMAME on the Mac. I've installed wxWidgets from Brew, and the first few files go well, but then...

Code
src/dialogs/inputs.cpp:146:75: warning: 'GetInputSeqRefs' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs();
                                                                                        ^
src/dialogs/inputs.cpp:113:75: note: overridden virtual function is here
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs() = 0;
                                                                                        ^
src/dialogs/inputs.cpp:165:75: warning: 'GetInputSeqRefs' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs();
                                                                                        ^
src/dialogs/inputs.cpp:113:75: note: overridden virtual function is here
                virtual std::vector<std::tuple<InputFieldRef, status::input_seq::type>> GetInputSeqRefs() = 0;

/usr/bin/../include/c++/v1/__hash_table:868:5: error: 
      static_assert failed due to requirement 'integral_constant<bool, false>::value' "the specified hash does not meet the Hash requirements"
    static_assert(__check_hash_requirements<_Key, _Hash>::value,
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/usr/bin/../include/c++/v1/__hash_table:883:1: note: 
      in instantiation of template class 'std::__1::__enforce_unordered_container_requirements<wxString, std::__1::hash<wxString>,
      std::__1::equal_to<wxString> >' requested here
typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type

/usr/bin/../include/c++/v1/unordered_map:856:26: note: 
      while substituting explicitly-specified template arguments into function template '__diagnose_unordered_container_requirements'
    static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), "");
                         ^
src/dialogs/inputs.cpp:214:43: note: in instantiation of template class 'std::__1::unordered_map<wxString, wxString, std::__1::hash<wxString>,
      std::__1::equal_to<wxString>, std::__1::allocator<std::__1::pair<const wxString, wxString> > >' requested here
                std::unordered_map<wxString, wxString>          m_codes;                                                         ^


There are a series of follow-on errors in inputs.cpp that seem to be caused by that.

I get worse errors on Linux actually, but we'll make Clang happy first and see if that helps there.

Joined: Nov 1999
Posts: 676
Likes: 1
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 676
Likes: 1
While it is not an overall surprised that you're getting compilation errors with clang (I've been using GCC and MSVC, and running into warnings that in practice only happen with certain compilers is par the course), those particular problems seem odd, as I see "override" declarations there:

https://github.com/npwoods/bletchmame/blob/master/src/dialogs/inputs.cpp#L146
https://github.com/npwoods/bletchmame/blob/master/src/dialogs/inputs.cpp#L165

Joined: Mar 2001
Posts: 16,679
Likes: 4
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,679
Likes: 4
I'm more concerned about the invalid hash error than the override warnings right now smile

Joined: Jun 2001
Posts: 436
O
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 436
I don't see an override at line 162 on your link.

Joined: Nov 1999
Posts: 676
Likes: 1
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 676
Likes: 1
Good call OG, I added a few overrides. I tried to make that particular warning fail the compilation, but that caused some problems with the wxWidgets headers.

I don't know what to make of the hash problem, other than the fact that I don't see that problem on Windows. wxString derives from std::basic_string, which I would (perhaps naively) expect to just work with std::hash.

Joined: Mar 2001
Posts: 16,679
Likes: 4
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,679
Likes: 4
wxString doesn't derive from std::string on UTF-8 native systems (anything non-Windows, basically) so it's incompatible with std::hash.

Joined: Nov 1999
Posts: 676
Likes: 1
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 676
Likes: 1
Ugh; I'm pretty dependent on wxString being usable in C++ data structures... what to do :-|

Joined: Jun 2001
Posts: 436
O
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 436
Add a specialization of std::hash of wxString. That's reasonably simple. Here's what I used for QString:
Code
 namespace std {
 template<> struct hash<QString> {
     std::size_t operator()(const QString &s) const {
         return qHash(s);
     }
 };
 }

Joined: Nov 1999
Posts: 676
Likes: 1
B
Bletch Offline OP
Senior Member
OP Offline
Senior Member
B
Joined: Nov 1999
Posts: 676
Likes: 1
Hmmm I think I know why I don't have this problem. There is a define wxUSE_STD_STRING that seems to be 1 for me, and probably not for you.

Particularly odd is this code from wx/string.h:
Code
// Don't do this if ToStdWstring() is not available. We could work around it
// but, presumably, if using std::wstring is undesirable, then so is using
// std::hash<> anyhow.
#if wxUSE_STD_STRING

#include <functional>

namespace std
{
    template<>
    struct hash<wxString>
    {
        size_t operator()(const wxString& s) const
        {
            return std::hash<std::wstring>()(s.ToStdWstring());
        }
    };
} // namespace std

#endif // wxUSE_STD_STRING

This looks like laziness on the part of the wxWidgets developers to me. Hash functions are easy to write.

In any case, I tried adding template specializations that only kick in when wxUSE_STD_STRING is off.

Page 1 of 2 1 2

Link Copied to Clipboard
Who's Online Now
1 members (MAMEBase), 65 guests, and 3 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,879
Posts116,775
Members4,958
Most Online890
Jan 17th, 2020
Forum Host
These forums are hosted by www.retrogamesformac.com
Forum hosted by www.retrogamesformac.com