马春杰杰 Exit Reader Mode

base/bittorrent/session.cpp:629:63: error: call of overloaded ‘asConst(QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’

编译Qbittorrent的时候出现:

cd src/ && ( test -e Makefile || /usr/lib64/qt5/bin/qmake -o Makefile /home/sipl/qBittorrent-release-4.1.9/src/src.pro QMAKE_LRELEASE= ) && make -f Makefile 
make[1]: Entering directory `/home/sipl/qBittorrent-release-4.1.9/src'
compiling app/qtsingleapplication/qtsinglecoreapplication.cpp
compiling app/qtsingleapplication/qtlocalpeer.cpp
compiling app/application.cpp
compiling app/cmdoptions.cpp
compiling app/filelogger.cpp
compiling app/main.cpp
compiling base/asyncfilestorage.cpp
compiling base/bittorrent/filepriority.cpp
compiling base/bittorrent/infohash.cpp
compiling base/bittorrent/magneturi.cpp
compiling base/bittorrent/peerinfo.cpp
compiling base/bittorrent/private/bandwidthscheduler.cpp
compiling base/bittorrent/private/filterparserthread.cpp
compiling base/bittorrent/private/resumedatasavingmanager.cpp
compiling base/bittorrent/private/speedmonitor.cpp
compiling base/bittorrent/private/statistics.cpp
compiling base/bittorrent/session.cpp
compiling base/bittorrent/torrentcreatorthread.cpp
base/bittorrent/session.cpp: In member function ‘void BitTorrent::Session::setTempPathEnabled(bool)’:
base/bittorrent/session.cpp:615:63: error: call of overloaded ‘asConst(QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’ is ambiguous
         for (TorrentHandle *const torrent : asConst(m_torrents))
                                                               ^
base/bittorrent/session.cpp:615:63: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&; typename std::add_const<_Tp>::type = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘void BitTorrent::Session::setAppendExtensionEnabled(bool)’:
base/bittorrent/session.cpp:629:63: error: call of overloaded ‘asConst(QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’ is ambiguous
         for (TorrentHandle *const torrent : asConst(m_torrents))
                                                               ^
base/bittorrent/session.cpp:629:63: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&; typename std::add_const<_Tp>::type = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘bool BitTorrent::Session::deleteTorrent(const QString&, bool)’:
base/bittorrent/session.cpp:1942:65: error: call of overloaded ‘asConst(QStringList&)’ is ambiguous
         for (const QString &unwantedFile : asConst(unwantedFiles)) {
                                                                 ^
base/bittorrent/session.cpp:1942:65: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QStringList; typename std::add_const<_Tp>::type = const QStringList]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QStringList&; typename std::add_const<_Tp>::type = QStringList&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘void BitTorrent::Session::generateResumeData(bool)’:
base/bittorrent/session.cpp:2389:59: error: call of overloaded ‘asConst(QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’ is ambiguous
     for (TorrentHandle *const torrent : asConst(m_torrents)) {
                                                           ^
base/bittorrent/session.cpp:2389:59: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&; typename std::add_const<_Tp>::type = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘void BitTorrent::Session::saveTorrentsQueue()’:
base/bittorrent/session.cpp:2448:45: error: call of overloaded ‘asConst(QMap<int, QString>&)’ is ambiguous
     for (const QString &hash : asConst(queue))
                                             ^
base/bittorrent/session.cpp:2448:45: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QMap<int, QString>; typename std::add_const<_Tp>::type = const QMap<int, QString>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QMap<int, QString>&; typename std::add_const<_Tp>::type = QMap<int, QString>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘void BitTorrent::Session::setTempPath(QString)’:
base/bittorrent/session.cpp:2484:59: error: call of overloaded ‘asConst(QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’ is ambiguous
     for (TorrentHandle *const torrent : asConst(m_torrents))
                                                           ^
base/bittorrent/session.cpp:2484:59: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&; typename std::add_const<_Tp>::type = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘bool BitTorrent::Session::hasPerTorrentRatioLimit() const’:
base/bittorrent/session.cpp:3809:59: error: call of overloaded ‘asConst(const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’ is ambiguous
     for (TorrentHandle *const torrent : asConst(m_torrents))
                                                           ^
base/bittorrent/session.cpp:3809:59: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘bool BitTorrent::Session::hasPerTorrentSeedingTimeLimit() const’:
base/bittorrent/session.cpp:3817:59: error: call of overloaded ‘asConst(const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’ is ambiguous
     for (TorrentHandle *const torrent : asConst(m_torrents))
                                                           ^
base/bittorrent/session.cpp:3817:59: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘void BitTorrent::Session::startUpTorrents()’:
base/bittorrent/session.cpp:3961:69: error: call of overloaded ‘asConst(QStringList&)’ is ambiguous
             for (const QString &fastresumeName : asConst(fastresumes)) {
                                                                     ^
base/bittorrent/session.cpp:3961:69: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QStringList; typename std::add_const<_Tp>::type = const QStringList]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QStringList&; typename std::add_const<_Tp>::type = QStringList&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp:4000:87: error: call of overloaded ‘asConst(QMap<int, BitTorrent::Session::startUpTorrents()::TorrentResumeData>&)’ is ambiguous
             for (const TorrentResumeData &torrentResumeData : asConst(queuedResumeData))
                                                                                       ^
base/bittorrent/session.cpp:4000:87: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QMap<int, BitTorrent::Session::startUpTorrents()::TorrentResumeData>; typename std::add_const<_Tp>::type = const QMap<int, BitTorrent::Session::startUpTorrents()::TorrentResumeData>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QMap<int, BitTorrent::Session::startUpTorrents()::TorrentResumeData>&; typename std::add_const<_Tp>::type = QMap<int, BitTorrent::Session::startUpTorrents()::TorrentResumeData>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp:4022:61: error: call of overloaded ‘asConst(QStringList&)’ is ambiguous
     for (const QString &fastresumeName : asConst(fastresumes)) {
                                                             ^
base/bittorrent/session.cpp:4022:61: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QStringList; typename std::add_const<_Tp>::type = const QStringList]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QStringList&; typename std::add_const<_Tp>::type = QStringList&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/session.cpp: In member function ‘void BitTorrent::Session::handleStateUpdateAlert(libtorrent::state_update_alert*)’:
base/bittorrent/session.cpp:4622:59: error: call of overloaded ‘asConst(QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&)’ is ambiguous
     for (TorrentHandle *const torrent : asConst(m_torrents)) {
                                                           ^
base/bittorrent/session.cpp:4622:59: note: candidates are:
In file included from base/bittorrent/session.cpp:73:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>; typename std::add_const<_Tp>::type = const QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&; typename std::add_const<_Tp>::type = QHash<BitTorrent::InfoHash, BitTorrent::TorrentHandle*>&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
make[1]: *** [session.o] Error 1
make[1]: *** Waiting for unfinished jobs....
base/bittorrent/torrentcreatorthread.cpp: In member function ‘virtual void BitTorrent::TorrentCreatorThread::run()’:
base/bittorrent/torrentcreatorthread.cpp:113:48: error: call of overloaded ‘asConst(QStringList&)’ is ambiguous
             for (const auto &dir : asConst(dirs)) {
                                                ^
base/bittorrent/torrentcreatorthread.cpp:113:48: note: candidates are:
In file included from base/bittorrent/torrentcreatorthread.cpp:45:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QStringList; typename std::add_const<_Tp>::type = const QStringList]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QStringList&; typename std::add_const<_Tp>::type = QStringList&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/torrentcreatorthread.cpp:129:58: error: call of overloaded ‘asConst(QStringList&)’ is ambiguous
             for (const auto &fileName : asConst(fileNames))
                                                          ^
base/bittorrent/torrentcreatorthread.cpp:129:58: note: candidates are:
In file included from base/bittorrent/torrentcreatorthread.cpp:45:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QStringList; typename std::add_const<_Tp>::type = const QStringList]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QStringList&; typename std::add_const<_Tp>::type = QStringList&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/torrentcreatorthread.cpp:144:54: error: call of overloaded ‘asConst(QStringList&)’ is ambiguous
         for (QString seed : asConst(m_params.urlSeeds)) {
                                                      ^
base/bittorrent/torrentcreatorthread.cpp:144:54: note: candidates are:
In file included from base/bittorrent/torrentcreatorthread.cpp:45:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QStringList; typename std::add_const<_Tp>::type = const QStringList]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QStringList&; typename std::add_const<_Tp>::type = QStringList&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
base/bittorrent/torrentcreatorthread.cpp:151:64: error: call of overloaded ‘asConst(QStringList&)’ is ambiguous
         for (const QString &tracker : asConst(m_params.trackers)) {
                                                                ^
base/bittorrent/torrentcreatorthread.cpp:151:64: note: candidates are:
In file included from base/bittorrent/torrentcreatorthread.cpp:45:0:
./base/global.h:38:45: note: constexpr typename std::add_const<_Tp>::type& asConst(T&) [with T = QStringList; typename std::add_const<_Tp>::type = const QStringList]
 constexpr typename std::add_const<T>::type &asConst(T &t) noexcept { return t; }
                                             ^
./base/global.h:42:44: note: constexpr typename std::add_const<_Tp>::type asConst(T&&) [with T = QStringList&; typename std::add_const<_Tp>::type = QStringList&]
 constexpr typename std::add_const<T>::type asConst(T &&t) noexcept { return std::move(t); }
                                            ^
make[1]: *** [torrentcreatorthread.o] Error 1
make[1]: Leaving directory `/home/sipl/qBittorrent-release-4.1.9/src'
make: *** [sub-src-make_first] Error 2

这是gcc版本的问题,注意使用gcc -v查看下是不是对应的。

本文最后更新于2021年8月16日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!