【问题标题】:Using std::thread in AppVeyor with Qt在带有 Qt 的 AppVeyor 中使用 std::thread
【发布时间】:2019-03-28 10:50:37
【问题描述】:

我正在尝试将 AppVeyor 用于使用 Qt 制作的 C++ 程序。 我的 appveyor.yml 只做以下 3 件事:

    - cd Project
    - qmake Project.pro
    - mingw32-make

但是当 AppVeyor 试图编译我的项目时,它会告诉我

    error: 'thread' is not a member of 'std'

我确定问题不在于我的代码,因为它可以在我的计算机上或在使用 Travis CI 时运行

我还提供了 CI 的链接以防万一: https://ci.appveyor.com/project/Xwilarg/programmanager/builds/23421335

请问有人知道如何在 AppVeyor 中使用 std::thread 吗?

【问题讨论】:

标签: c++ qt stdthread appveyor


【解决方案1】:

我假设你已经包含了<thread>,所以下一个猜测是std::thread 是c++11 的一部分。您需要在项目中启用 c++11。

【讨论】:

  • 我在使用 unique_ptr 之类的东西时没有任何问题,所以我认为该项目已经启用了 C++11
【解决方案2】:

我终于找到了我的问题的答案。

正如 Shloim 所说,我必须使用 https://github.com/meganz/mingw-std-threads

然后我的 CI 找不到 GetNativeSystemInfo,所以我不得不在编译标志中添加 -D _WIN32_WINNT=0x0501

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-07
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-18
    相关资源
    最近更新 更多