【问题标题】:Couldn't build google mock无法构建谷歌模拟
【发布时间】:2015-12-10 08:34:22
【问题描述】:

我尝试使用 MinGW 在 Windows 7 上构建 google mock。但我做不到。

我通过单击“下载 Zip”按钮从下面的网站下载了 google test 和 google mock。 [https://github.com/google/googletest][1]

我解压了文件,在命令行执行命令。

> g++ -c -Iinclude -I. src/gmock-all.cc

但是发生了错误。

> include/gmock/internal/gmock-port.h:53:45: fatal error: gtest/internal/gtest-linked_ptr.h: No such file or directory

我该如何解决?

【问题讨论】:

    标签: c++ unit-testing googletest googlemock


    【解决方案1】:

    您应该先构建 googletest,然后再构建 googlemock。它捆绑在一起 在名为“gtest”的子目录中使用 googlemock。这是你需要做的:

    g++ -isystem <path_to_gtest>/include -I<path_to_gtest> \
      -isystem <path_to_gmock>/include -I<path_to_gmock> \
      -pthread -c <path_to_gtest>/src/gtest-all.cc
    g++ -isystem <path_to_gtest>/include -I<path_to_gtest> \
      -isystem <path_to_gmock>/include -I<path_to_gmock> \
      -pthread -c <path_to_gmock>/src/gmock-all.cc
    

    这绝对可以在 Linux 上运行,但我不能 100% 确定 MinGW 在 赢7。如果没有帮助,我建议使用 Visual Studio Community Edition。 您已经在 &lt;path_to_gmock&gt;/msvc/2010 中设置了 VS 解决方案。它 是VS2010的解决方案,但是用更新的版本打开会提示你 升级工具集。只需接受并在其中构建“gmock”项目 solution.o_gmock>/src/gmock-all.cc

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-25
      • 1970-01-01
      • 1970-01-01
      • 2012-12-10
      • 2020-04-14
      • 2013-08-07
      相关资源
      最近更新 更多