【问题标题】:Google Test + VSCode + WINDOWS, how can I use gtest in window OS?Google Test + VSCode + WINDOWS,如何在window OS中使用gtest?
【发布时间】:2023-03-05 13:10:01
【问题描述】:

当我使用 gtest 和 gmock 在窗口 vscode 上测试 cpp 文件时, 我遇到了很多错误..

所以,我遵循以下准则, https://medium.com/swlh/google-test-installation-guide-for-c-in-windows-for-visual-studio-code-2b2e66352456

collect2.exe: error: ld returned 1 exit status 发生了。

但是 gtest 在 Visual Studio 上运行良好!!但它不适用于上图的 vscode。

我该如何处理这个问题? 另外,我想知道如何在窗口 vscode 中测试 cpp 文件...

【问题讨论】:

标签: c++ windows visual-studio-code googletest


【解决方案1】:

您下载了不适合您的编译器的libgtest.alibgtest_main.a 库。使用来自官方 Google 测试存储库的源的 Google 测试来构建您自己的库https://github.com/google/googletest/tree/release-1.11.0

恕我直言,您使用的指南演示了将库和头文件复制到编译器目录的不良做法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-28
    • 1970-01-01
    • 2013-08-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多