- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个庞大而复杂的项目,最终要进行单元测试。我已经使用 Visual Studio 2010 在本地构建了 googleTest 1.6.0,项目文件是按照 README 指定的那样使用 cmake 构建的。
这个项目有很多静态和动态链接的依赖库。其中许多是专有的。所有链接尝试都会产生 220 个此类错误。这是一个示例:
msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: void __cdecl std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QEAAXXZ) already defined in gtest.lib(gtest-all.obj)
libcpmtd.lib(cerr.obj) : error LNK2005: "protected: char * __cdecl std::basic_streambuf >::_Gndec(void)" (?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ) already defined in msvcprtd.lib(MSVCP100D.dll)
LIBCMTD.lib(setlocal.obj) : error LNK2005: _configthreadlocale already defined in MSVCRTD.lib(MSVCR100D.dll)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
fatal error LNK1169: one or more multiply defined symbols found
我已经尝试了/NODEFAULTLIB 标志,并且我试图按照建议仅忽略 msvcprtd.lib、MSVCRTD.lib 和 LIBCMTD.lib,但后来我遇到了无法解析的符号问题...
项目和 googleTest 都是用 x64、/MP、/MDd 编译的,没有/clr。
我一直在研究编译器标志,想知道是否存在某种版本不匹配。 Dumpbin,就我的理解而言,并没有暗示任何我可能理解的东西。我希望有一个呃
最佳答案
您的问题似乎已在 Google Talk 的 FAQ 中得到解答.确保您所有的库都使用/MD(d) 设置。
You may get a number of the following linker error or warnings if you attempt to link your test project with the Google Test library when your project and the are not built using the same compiler settings.
- LNK2005: symbol already defined in object
- LNK4217: locally defined symbol 'symbol' imported in function 'function'
- LNK4049: locally defined symbol 'symbol' imported The Google Test project (gtest.vcproj) has the Runtime Library option set to /MT (use multi-threaded static libraries, /MTd for debug). If your project uses something else, for example /MD (use multi-threaded DLLs, /MDd for debug), you need to change the setting in the Google Test project to match your project's.
To update this setting open the project properties in the Visual Studio IDE then select the branch Configuration Properties | C/C++ | Code Generation and change the option "Runtime Library". You may also try using gtest-md.vcproj instead of gtest.vcproj.
关于visual-studio-2010 - 由于其他依赖库,在 VS2010 中链接 googleTest 结果为 LNK2005,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15993912/
gtest 有没有办法让内联/测试用例甚至测试超时。 例如,我想做类似的事情: EXPECT_TIMEOUT(5 秒,myFunction()); 我从 2010 年 12 月 9 日发现这个问题 g
我正在尝试googletest。 以前,我一直在使用Boost测试,并且一直在使用宏BOOST_AUTO_TEST_SUITE将测试分组到Testsuite中。 这使junit报告更具可读性。 我在g
我的 googletest 具有以下结构: void check(Arg a1, Arg a2) { EXPECT_TRUE(a1 == a2); } TEST(s, t) { a1 =
我有 2 种方法的类(class) class A { void Fun() { if(FunRet()>0){///} else {///} } int FunRet()
我正在使用 gtest 编写一个类型参数化的测试装置,我看到了 not declared in this scope当我尝试使用夹具类的成员时出现编译器错误。 当我不使用类型参数化装置时,我可以很好地
我在gtest中使用值参数化测试。例如,如果我写 INSTANTIATE_TEST_CASE_P(InstantiationName, FooTest,
我有一个用C ++编写的程序,其中一些子文件夹包含链接的库。有一个顶级SConscript,它在子文件夹/库中调用SConscript文件。 在库cpp中,有一个GTest: TEST(X, just
为了对某些代码进行 BDD 风格的测试,我有一组测试,我想针对多个场景执行这些测试。我已经在 C# 中使用 NUnit & NSubstitute 多次这样做了,但是我正在努力使用 GoogleTes
我正在尝试为向量编写测试。 对于 STL 容器,我尝试过: EXPECT_THAT(float_vec1, ElementsAreArray(float_vec2)); 但是我需要插入一个边距。 有没
使用 Google Test 1.6(Windows 7、Visual Studio C++)。如何关闭给定的测试? (又名如何阻止测试运行)。除了注释掉整个测试之外,我还能做些什么吗? 最佳答案 d
如果一个测试有多个EXPECT_*语句 TEST_F(TestClass, ServerTest) { // Start server server_.start(); usl
当我编写测试夹具来测试一些 C 代码时,我使用相同的设置: https://github.com/google/googletest/blob/master/googletest/docs/prime
给定一个包含数千个测试的大型项目,其中一些测试需要几分钟才能完成。按顺序执行时,整套测试需要一个多小时才能完成。通过并行执行测试可以减少测试时间。 据我所知,没有办法直接从 googletest/mo
我在 googletest 中运行一些单元测试。我期望对模拟函数的某些调用 (EXPECT_CALL(*rtosMock, xQueueGenericSend( arg , _, _, _)).Tim
我刚刚开始学习 googletesting,并且正在使用它。我想使用参数化测试来检查类的函数成员返回的值是否是它应该的值。我已经声明了一个名为“myClass”的类,在其中我使用构造函数设置了一个变量
我有一个抽象基类,它具有处理线程生命周期(启动、停止、加入)的逻辑。线程中执行的工作依赖于实例化的派生类,派生类有几个。 基类如下所示: class Base { public: Base(i
是什么原因,为什么GoogleTest对参数计数使用引用? testing::InitGoogleTest(&argc, argv); (我的意思是:据我了解,这是一个输入参数,没有任何区别是否提
我正在为遗留代码创建测试,想知道是否可以像这样检查类的成员变量的值(我知道我下面的代码非常糟糕,糟糕的例子:/。希望只是请关注关于问题): class Animal { public: RESU
这是我的测试夹具:https://github.com/patrykbajos/ZinotEngine/blob/master/src/tests/core/MapResMgrTest.cpp .此可
我想知道,是否有可能检查失败的 ASSERT 或 EXPECT 语句,这些语句发生在被调用函数内部并且独立于任何其他或先前的失败 ASSERT/EXPECT 语句。基本上: void subcheck
我是一名优秀的程序员,十分优秀!