首页 > 解决方案 > gmock-generated-actions.h 中的 Gmock 编译错误

问题描述

我使用以下命令在 ubunutu 16.04 上安装了 Grock amd64 (1.7.0-18092013-1):sudo apt-get install google-mock。但是,当包含 gmock/gmock.h 时,我收到以下错误:错误 截图


/usr/include/gmock/gmock-generated-actions.h:在 'static R testing::internal::CallableHelper::Call(Function) 的实例化中 [with Function = e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void ); R = testing::internal::IgnoredValue]': /usr/include/gmock/gmock-generated-actions.h:2264:53: 来自'typename testing::internal::Function::Result testing::InvokeArgumentAction: :gmock_Impl::gmock_PerformImpl(const args_type&, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg9_type) const [with arg0_type = e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void); arg1_type = testing::internal::ExcessiveArg; arg2_type = testing::internal::ExcessiveArg; arg3_type = testing::internal::ExcessiveArg; arg4_type = testing::internal::ExcessiveArg; arg5_type = testing::internal::ExcessiveArg; arg6_type = testing::internal::ExcessiveArg; arg7_type = testing::internal::ExcessiveArg; arg8_type = testing::internal::ExcessiveArg; arg9_type = testing::internal::ExcessiveArg; F = testing::internal::IgnoredValue(e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void )); 诠释 k = 0; 类型名 testing::internal::Function::Result = testing::internal::IgnoredValue; testing::InvokeArgumentAction::gmock_Impl::args_type = std::tuple<e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void)>]' /usr/include/gmock/gmock-generated-actions.h:655:23: 来自'静态结果测试::internal::ActionHelper<Result, Impl>::Perform(Impl*, const std: :tuple&) [with A0 = e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void ); 结果 = testing::internal::IgnoredValue; Impl = testing::InvokeArgumentAction<0>::gmock_Impl<testing::internal::IgnoredValue(e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void ))>]' /usr/include/gmock/gmock-generated-actions.h:2261: 1:需要从'testing::InvokeArgumentAction::gmock_Impl::return_type testing::InvokeArgumentAction::gmock_Impl::Perform(const args_type&) [with F = testing::internal::IgnoredValue(e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void)); 诠释 k = 0; testing::InvokeArgumentAction::gmock_Impl::return_type = testing::internal::IgnoredValue; testing::InvokeArgumentAction::gmock_Impl::args_type = std::tuple<e_lc_ReturnCode_t ( )(e_lc_ResumeReason_t, void )>]' /usr/include/gmock/gmock-generated-actions.h:300:53:错误:太少函数静态R调用的参数(函数函数){返回函数();}


/usr/include/gmock/gmock-generated-actions.h:在 'static R testing::internal::CallableHelper::Call(Function, A1) 的实例化中 [with Function = e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t, void ); A1 = e_lc_Shutdowntype_t; R = testing::internal::IgnoredValue]': /usr/include/gmock/gmock-generated-actions.h:2271:53: 来自'typename testing::internal::Function::Result testing::InvokeArgumentActionP< k, p0_type>::gmock_Impl::gmock_PerformImpl(const args_type&, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg9_type) const [with arg0_type = e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t,); arg1_type = testing::internal::ExcessiveArg; arg2_type = testing::internal::ExcessiveArg; arg3_type = testing::internal::ExcessiveArg; arg4_type = testing::internal::ExcessiveArg; arg5_type = testing::internal::ExcessiveArg; arg6_type = testing::internal::ExcessiveArg; arg7_type = testing::internal::ExcessiveArg; arg8_type = testing::internal::ExcessiveArg; arg9_type = testing::internal::ExcessiveArg; F = testing::internal::IgnoredValue(e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t, void )); 诠释 k = 0; p0_type = e_lc_Shutdowntype_t; 类型名 testing::internal::Function::Result = testing::internal::IgnoredValue; testing::InvokeArgumentActionP<k, p0_type>::gmock_Impl::args_type = std::tuple<e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t, void)>]' /usr/include/gmock/gmock-generated-actions.h:655:23: 来自'静态结果测试::internal::ActionHelper<Result, Impl>::Perform(Impl*, const std: :tuple&) [with A0 = e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t, void ); 结果 = testing::internal::IgnoredValue; Impl = testing::InvokeArgumentActionP<0, e_lc_Shutdowntype_t>::gmock_Impl<testing::internal::IgnoredValue(e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t, void ))>]' /usr/include/gmock/gmock-generated-actions.h: 2268:1:'testing::InvokeArgumentActionP<k, p0_type>::gmock_Impl::return_type testing::InvokeArgumentActionP<k, p0_type>::gmock_Impl::Perform(const args_type&) [with F = testing::internal: :IgnoredValue(e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t, void)); 诠释 k = 0; p0_type = e_lc_Shutdowntype_t; testing::InvokeArgumentActionP<k, p0_type>::gmock_Impl::return_type = testing::internal::IgnoredValue; testing::InvokeArgumentActionP<k, p0_type>::gmock_Impl::args_type = std::tuple<e_lc_ReturnCode_t ( )(e_lc_Shutdowntype_t, void )>]' test_rp.cpp:1140:1: 这里需要 /usr/include/gmock/ gmock-generated-actions.h:316:60:错误:函数静态 R Call(Function function, A1 a1) { return function (a1);的参数太少;}


你们对导致这些错误弹出的原因有任何想法吗

标签: unit-testinggoogletestgmock

解决方案


推荐阅读