【问题标题】:Unable to Build Google Test with MinGW and MSYS - crtdbg.h not found无法使用 MinGW 和 MSYS 构建 Google 测试 - 找不到 crtdbg.h
【发布时间】:2020-04-17 20:05:39
【问题描述】:

我正在尝试在this page 的帮助下使用 MSYS 和 MinGW 构建 Google Test。

我在 MS Windows 10 Home 上安装了 MinGW 和 MSYS。到目前为止,我已经在 MSYS 终端的 Google 测试源代码目录中运行了这些命令:

mkdir build

cd build

cmake -G "MSYS Makefiles" ..

make

make 命令失败,输出如下:

In file included from c:/MinGW/msys/1.0/home/mkkek/googletest-release-1.10.0/googletest/src/gtest-all.cc:41:
C:/MinGW/msys/1.0/home/mkkek/googletest-release-1.10.0/googletest/src/gtest.cc:86:11: fatal error: crtdbg.h: No such file or directory
   86 | # include <crtdbg.h>  // NOLINT
      |           ^~~~~~~~~~
compilation terminated.
make[2]: *** [googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
make[1]: *** [googletest/CMakeFiles/gtest.dir/all] Error 2
make: *** [all] Error 2

crtdbg.h 似乎是一个 Visual C++ 头文件。我确实安装了 Windows 10 SDK 和 Visual C++,但构建系统没有找到标头。

我读过this thread,但那里的提示都没有帮助。

我将不胜感激。

【问题讨论】:

  • 我正在使用 MSYS2(以及它提供的 MinGW/GCC),文件就在那里。我建议切换到 MSYS2(无论如何都更好)。

标签: c++ mingw googletest msys


【解决方案1】:

我按照 cmets 中的建议切换到 MSYS2,并成功构建了库。

我按照project home page 上的说明安装了 MSYS2。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-28
    • 1970-01-01
    • 2013-05-14
    • 2022-11-18
    • 1970-01-01
    • 2012-06-06
    • 2013-05-06
    • 1970-01-01
    相关资源
    最近更新 更多