Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: no member named 'keyRecorded' in 'HotkeyWrapper' #1666

Open
ryandesign opened this issue Aug 18, 2023 · 4 comments
Open

error: no member named 'keyRecorded' in 'HotkeyWrapper' #1666

ryandesign opened this issue Aug 18, 2023 · 4 comments

Comments

@ryandesign
Copy link

On some older versions of macOS (macOS 10.12.x and earlier, in my testing), goldendict 1.5.0 fails to compile:

compiling build/moc_hotkeywrapper.cpp
compiling build/moc_hotkeyedit.cpp
moc editdictionaries.hh
compiling build/moc_loaddictionaries.cpp
compiling build/moc_website.cpp
compiling build/moc_orderandprops.cpp
compiling build/moc_dictionarybar.cpp
compiling build/moc_history.cpp
compiling build/moc_articlewebview.cpp
build/moc_hotkeywrapper.cpp:88:21: error: no member named 'keyRecorded' in 'HotkeyWrapper'
        case 1: _t->keyRecorded((*reinterpret_cast< quint32(*)>(_a[1])),(*reinterpret_cast< quint32(*)>(_a[2]))); break;
                ~~  ^
build/moc_hotkeywrapper.cpp:90:33: error: no member named 'checkState' in 'HotkeyWrapper'
        case 3: { bool _r = _t->checkState((*reinterpret_cast< quint32(*)>(_a[1])),(*reinterpret_cast< quint32(*)>(_a[2])));
                            ~~  ^
build/moc_hotkeywrapper.cpp:105:83: error: no member named 'keyRecorded' in 'HotkeyWrapper'
            if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&HotkeyWrapper::keyRecorded)) {
                                                                   ~~~~~~~~~~~~~~~^
compiling build/moc_webmultimediadownload.cpp
build/moc_hotkeywrapper.cpp:157:21: error: out-of-line definition of 'keyRecorded' does not match any declaration in 'HotkeyWrapper'
void HotkeyWrapper::keyRecorded(quint32 _t1, quint32 _t2)
                    ^~~~~~~~~~~
compiling build/moc_forvo.cpp
4 errors generated.
make: *** [build/moc_hotkeywrapper.o] Error 1
make: *** Waiting for unfinished jobs....
@nonwill
Copy link

nonwill commented Aug 19, 2023

On macOS 10.13 and above, the project was compiled successfully.

build/moc_hotkeywrapper.cpp:157:21: error: out-of-line definition of 'keyRecorded' does not match any declaration in 'HotkeyWrapper'
void HotkeyWrapper::keyRecorded(quint32 _t1, quint32 _t2)
^~~~~~~~~~~

HotkeyWrapper::keyRecorded is for XRecord*(X11 Uinux-like system, but not macOS)......

@vedgy
Copy link
Member

vedgy commented Aug 19, 2023

#ifndef Q_OS_MAC
private slots:
bool checkState( quint32 vk, quint32 mod );
#endif

From hotkeywrapper.hh starting from the line 117 (ellipses stand for uninteresting skipped code fragments):

#elif defined(Q_OS_MAC)
...
#else
...
  void keyRecorded( quint32 vk, quint32 mod );

#endif

Either Q_OS_MAC is not defined in the Qt versions you use on macOS 10.12.x and earlier, or Qt's moc gets confused by all the ifdefs in hotkeywrapper.hh. A workaround in the first case is to pass the necessary preprocessor definition to qmake: qmake DEFINES+=Q_OS_MAC. In the second case, manually remove the code fragments disabled on macOS from hotkeywrapper.hh.

@ryandesign
Copy link
Author

On macOS 10.12.x, I'm using Qt 5.13.2. On 10.13.x and later, I'm using Qt 5.15.10. In both versions, Q_OS_MAC appears to be defined in qsystemdetection.h.

Documentation says to #include <QtGlobal> for access to Q_OS_MAC and related macros. Q_OS_MAC is used in 17 files in goldendict 1.5.0 but QtGlobal is only included in 4 files (and not any of the 17 that use the marco). Could this be a situation where the header just needs to be included in various places?

I'm wary of trying to define Q_OS_MAC manually, since that's not the only macro the header provides.

@vedgy
Copy link
Member

vedgy commented Aug 20, 2023

hotkeywrapper.hh includes <QtGui>, which pulls in the entire GUI module and is clearly an overkill. <QtGui> definitely includes <QtGlobal>'s equivalent "qglobal.h" (almost every Qt header does). You can try including <QtGlobal> explicitly, but it's very unlikely to help.

I'm wary of trying to define Q_OS_MAC manually, since that's not the only macro the header provides.

Just try it if you have ready access to a macOS 10.12 system. It probably won't help either, but the result would allow to rule out a possible root cause of the build failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants