stdware / qwindowkit

Cross-platform frameless window framework for Qt. Support Windows, macOS, Linux.
Apache License 2.0
490 stars 78 forks source link

编译报错 #35

Closed wangdemon closed 6 months ago

wangdemon commented 7 months ago

1 QtCreator编译,使用msvc模式编译,没有问题

2 QtCreator编译,使用mingw编译,一堆错误(Qt5.15.2版本)

1

这是提示的日志文件 qmsetup_build-Release.log

LeoLei8060 commented 7 months ago

Qt5.15.2版本的Mingw是8.1版本,不兼容qmsetup子模块

LeoLei8060 commented 7 months ago

https://forum.qt.io/topic/129603/building-qt-5-15-2-windows-10-mingw-c-17-issue/4

wangwenx190 commented 7 months ago

必须把所有子模块都克隆下来,如果你直接下载的zip包或者clone时没有加--recursive参数,都会导致子模块遗漏

wangwenx190 commented 7 months ago

Qt5.15.2版本的Mingw是8.1版本,不兼容qmsetup子模块

如何不兼容?报什么错?

wangdemon commented 7 months ago

必须把所有子模块都克隆下来,如果你直接下载的zip包或者clone时没有加--recursive参数,都会导致子模块遗漏

加了--recursive参数

msv模式编译,是可以成功编译的

只是在mingw模式编译失败

1

ytchn commented 7 months ago

我也遇到了同样的编译问题(Qt5.15.2)。 1 QtCreator + msvc模式编译通过 2 QtCreator+mingw编译失败,错误提示及日志,和[wangdemon]反馈的一致。

LeoLei8060 commented 7 months ago

@wangwenx190 错误如下,参考链接:https://stackoverflow.com/questions/50546025/mingw-w64-8-1-0-rev-0-doesnt-compile-when-including-filesystem

FAILED: src/corecmd/CMakeFiles/corecmd.dir/utils.cpp.obj 
C:\Qt\Tools\mingw810_64\bin\c++.exe -DSYSCMDLINE_STATIC -DTOOL_DESC="\"QMSetup Core Utility Command, Version 0.0.1.5\"" -DTOOL_VERSION=\"0.0.1.5\" -D_CRT_SECURE_NO_WARNINGS -ID:/github/qwindowkit/qmsetup/src/syscmdline/include -O3 -DNDEBUG -std=c++2a -MD -MT src/corecmd/CMakeFiles/corecmd.dir/utils.cpp.obj -MF src\corecmd\CMakeFiles\corecmd.dir\utils.cpp.obj.d -o src/corecmd/CMakeFiles/corecmd.dir/utils.cpp.obj -c D:/github/qwindowkit/qmsetup/src/corecmd/utils.cpp
In file included from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.h:6,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.cpp:1:
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h: In member function 'std::filesystem::__cxx11::path& std::filesystem::__cxx11::path::operator/=(const std::filesystem::__cxx11::path&)':
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:47: error: no match for 'operator!=' (operand types are 'std::filesystem::__cxx11::path' and 'std::filesystem::__cxx11::path')
    || (__p.has_root_name() && __p.root_name() != root_name()))
                               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_algobase.h:64,
                 from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/char_traits.h:39,
                 from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/string:40,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.h:4,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.cpp:1:
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:456:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^~~~~~~~
wangwenx190 commented 7 months ago

根据stackoverflow的信息,貌似都是让你升级mingw到至少v9

SineStriker commented 7 months ago

@wangwenx190 错误如下,参考链接:https://stackoverflow.com/questions/50546025/mingw-w64-8-1-0-rev-0-doesnt-compile-when-including-filesystem

FAILED: src/corecmd/CMakeFiles/corecmd.dir/utils.cpp.obj 
C:\Qt\Tools\mingw810_64\bin\c++.exe -DSYSCMDLINE_STATIC -DTOOL_DESC="\"QMSetup Core Utility Command, Version 0.0.1.5\"" -DTOOL_VERSION=\"0.0.1.5\" -D_CRT_SECURE_NO_WARNINGS -ID:/github/qwindowkit/qmsetup/src/syscmdline/include -O3 -DNDEBUG -std=c++2a -MD -MT src/corecmd/CMakeFiles/corecmd.dir/utils.cpp.obj -MF src\corecmd\CMakeFiles\corecmd.dir\utils.cpp.obj.d -o src/corecmd/CMakeFiles/corecmd.dir/utils.cpp.obj -c D:/github/qwindowkit/qmsetup/src/corecmd/utils.cpp
In file included from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.h:6,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.cpp:1:
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h: In member function 'std::filesystem::__cxx11::path& std::filesystem::__cxx11::path::operator/=(const std::filesystem::__cxx11::path&)':
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:47: error: no match for 'operator!=' (operand types are 'std::filesystem::__cxx11::path' and 'std::filesystem::__cxx11::path')
    || (__p.has_root_name() && __p.root_name() != root_name()))
                               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_algobase.h:64,
                 from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/char_traits.h:39,
                 from C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/string:40,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.h:4,
                 from D:/github/qwindowkit/qmsetup/src/corecmd/utils.cpp:1:
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:456:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^~~~~~~~

MinGW 8.1 对 C++17 的支持有限,尤其是 filesystem 支持不完全,所以建议升级到 9 以上。README 里写了只在 MinGW 13 中测试过没问题。