gpt4 book ai didi

c++ - C++ Builder 的 GoogleMock 编译问题

转载 作者:行者123 更新时间:2023-11-30 04:08:56 27 4
gpt4 key购买 nike

我在尝试编译(和使用)googleMock 时遇到一些问题图书馆。它可以用 gcc 和 MS Visual Studio 完美编译,但我无法用 Rad Studio C++ Builder XE3 编译它。

当我尝试编译时出现这些错误:

Microsoft (R) Build Engine Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.5472]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 02/02/2014 11:30:03.
Project "C:\Users\danielepo\Desktop\gmock-1.7.0\src\gmock.cbproj" on node 0 (Build target(s)).
..\include\gmock/internal/gmock-internal-utils.h(216): error E2031: Cannot cast from 'int' to 'From'
..\include\gmock/internal/gmock-internal-utils.h(218): error E2031: Cannot cast from 'int' to 'From'
..\include\gmock/internal/gmock-internal-utils.h(216): error E2299: Cannot generate template specialization from 'bool_constant<bool_value>'
..\include\gmock/internal/gmock-internal-utils.h(216): error E2275: { expected
..\include\gmock/internal/gmock-internal-utils.h(257): error E2031: Cannot cast from 'KindOf<From>::value' to 'TypeKind'
..\include\gmock/internal/gmock-internal-utils.h(257): error E2031: Cannot cast from 'KindOf<To>::value' to 'TypeKind'
..\include\gmock/internal/gmock-internal-utils.h(257): error E2401: Invalid template argument list
..\include\gmock/internal/gmock-internal-utils.h(257): error E2303: Type name expected
..\include\gmock/internal/gmock-internal-utils.h(362): error E2430: Number of template parameters does not match in redeclaration of 'DecayArray<T[]>'
..\include\gmock/internal/gmock-internal-utils.h(364): error E2428: Templates must be classes or functions
..\include\gmock/gmock-actions.h(116): error E2040: Declaration terminated incorrectly
..\include\gmock/gmock-actions.h(138): error E2238: Multiple declaration for 'BuiltInDefaultValue<unsigned __int64>::Get()'
..\include\gmock/gmock-actions.h(75): error E2344: Earlier declaration of 'BuiltInDefaultValue<unsigned __int64>::Get()'
..\include\gmock/gmock-actions.h(139): error E2238: Multiple declaration for 'BuiltInDefaultValue<__int64>::Get()'
..\include\gmock/gmock-actions.h(75): error E2344: Earlier declaration of 'BuiltInDefaultValue<__int64>::Get()'
..\include\gmock/gmock-matchers.h(317): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(299): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(320): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher(const MatcherInterface<const std::string &> *)'
..\include\gmock/gmock-matchers.h(302): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher(const MatcherInterface<const std::string &> *)'
..\include\gmock/gmock-matchers.h(324): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher(const std::string &)'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher(const std::string &)'
..\include\gmock/gmock-matchers.h(328): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(328): error E2238: Multiple declaration for 'operator Matcher<const std::string &>::=(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of 'operator Matcher<const std::string &>::=(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(328): error E2238: Multiple declaration for '~Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of '~Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(334): error E2238: Multiple declaration for 'Matcher<std::string>::Matcher()'
..\include\gmock/gmock-matchers.h(299): error E2344: Earlier declaration of 'Matcher<std::string>::Matcher()'
..\include\gmock/gmock-matchers.h(337): error E2238: Multiple declaration for 'Matcher<std::string>::Matcher(const MatcherInterface<std::string> *)'
..\include\gmock/gmock-matchers.h(302): error E2344: Earlier declaration of 'Matcher<std::string>::Matcher(const MatcherInterface<std::string> *)'
..\include\gmock/gmock-matchers.h(345): error E2238: Multiple declaration for 'Matcher<std::string>::Matcher(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(319): error E2344: Earlier declaration of 'Matcher<std::string>::Matcher(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(345): error E2238: Multiple declaration for 'operator Matcher<std::string>::=(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(319): error E2344: Earlier declaration of 'operator Matcher<std::string>::=(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(345): error E2238: Multiple declaration for '~Matcher<std::string>::Matcher()'
..\include\gmock/gmock-matchers.h(319): error E2344: Earlier declaration of '~Matcher<std::string>::Matcher()'
..\include\gmock/gmock-spec-builders.h(1363): error E2468: Value of type void is not allowed
..\include\gmock/gmock-spec-builders.h(1373): error E2238: Multiple declaration for 'ActionResultHolder<void>::GetValueAndDelete() const'
..\include\gmock/gmock-spec-builders.h(1329): error E2344: Earlier declaration of 'ActionResultHolder<void>::GetValueAndDelete() const'
..\include\gmock/gmock-spec-builders.h(1375): error E2238: Multiple declaration for 'ActionResultHolder<void>::PrintAsActionResult(ostream *) const'
..\include\gmock/gmock-spec-builders.h(1336): error E2344: Earlier declaration of 'ActionResultHolder<void>::PrintAsActionResult(ostream *) const'
..\include\gmock/gmock-generated-function-mockers.h(866): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(868): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(877): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(879): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(888): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(890): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(899): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(901): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(901): error E2228: Too many error or warning messages
Done Building Project "C:\Users\danielepo\Desktop\gmock-1.7.0\src\gmock.cbproj" (Build target(s)) -- FAILED.

Build FAILED.

"C:\Users\danielepo\Desktop\gmock-1.7.0\src\gmock.cbproj" (Build target) (1) ->
(_BCC32CoreCompile target) ->
..\include\gmock/internal/gmock-internal-utils.h(216): error E2031: Cannot cast from 'int' to 'From'
..\include\gmock/internal/gmock-internal-utils.h(218): error E2031: Cannot cast from 'int' to 'From'
..\include\gmock/internal/gmock-internal-utils.h(216): error E2299: Cannot generate template specialization from 'bool_constant<bool_value>'
..\include\gmock/internal/gmock-internal-utils.h(216): error E2275: { expected
..\include\gmock/internal/gmock-internal-utils.h(257): error E2031: Cannot cast from 'KindOf<From>::value' to 'TypeKind'
..\include\gmock/internal/gmock-internal-utils.h(257): error E2031: Cannot cast from 'KindOf<To>::value' to 'TypeKind'
..\include\gmock/internal/gmock-internal-utils.h(257): error E2401: Invalid template argument list
..\include\gmock/internal/gmock-internal-utils.h(257): error E2303: Type name expected
..\include\gmock/internal/gmock-internal-utils.h(362): error E2430: Number of template parameters does not match in redeclaration of 'DecayArray<T[]>'
..\include\gmock/internal/gmock-internal-utils.h(364): error E2428: Templates must be classes or functions
..\include\gmock/gmock-actions.h(116): error E2040: Declaration terminated incorrectly
..\include\gmock/gmock-actions.h(138): error E2238: Multiple declaration for 'BuiltInDefaultValue<unsigned __int64>::Get()'
..\include\gmock/gmock-actions.h(75): error E2344: Earlier declaration of 'BuiltInDefaultValue<unsigned __int64>::Get()'
..\include\gmock/gmock-actions.h(139): error E2238: Multiple declaration for 'BuiltInDefaultValue<__int64>::Get()'
..\include\gmock/gmock-actions.h(75): error E2344: Earlier declaration of 'BuiltInDefaultValue<__int64>::Get()'
..\include\gmock/gmock-matchers.h(317): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(299): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(320): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher(const MatcherInterface<const std::string &> *)'
..\include\gmock/gmock-matchers.h(302): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher(const MatcherInterface<const std::string &> *)'
..\include\gmock/gmock-matchers.h(324): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher(const std::string &)'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher(const std::string &)'
..\include\gmock/gmock-matchers.h(328): error E2238: Multiple declaration for 'Matcher<const std::string &>::Matcher(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of 'Matcher<const std::string &>::Matcher(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(328): error E2238: Multiple declaration for 'operator Matcher<const std::string &>::=(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of 'operator Matcher<const std::string &>::=(const Matcher<const std::string &> &)'
..\include\gmock/gmock-matchers.h(328): error E2238: Multiple declaration for '~Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(307): error E2344: Earlier declaration of '~Matcher<const std::string &>::Matcher()'
..\include\gmock/gmock-matchers.h(334): error E2238: Multiple declaration for 'Matcher<std::string>::Matcher()'
..\include\gmock/gmock-matchers.h(299): error E2344: Earlier declaration of 'Matcher<std::string>::Matcher()'
..\include\gmock/gmock-matchers.h(337): error E2238: Multiple declaration for 'Matcher<std::string>::Matcher(const MatcherInterface<std::string> *)'
..\include\gmock/gmock-matchers.h(302): error E2344: Earlier declaration of 'Matcher<std::string>::Matcher(const MatcherInterface<std::string> *)'
..\include\gmock/gmock-matchers.h(345): error E2238: Multiple declaration for 'Matcher<std::string>::Matcher(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(319): error E2344: Earlier declaration of 'Matcher<std::string>::Matcher(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(345): error E2238: Multiple declaration for 'operator Matcher<std::string>::=(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(319): error E2344: Earlier declaration of 'operator Matcher<std::string>::=(const Matcher<std::string> &)'
..\include\gmock/gmock-matchers.h(345): error E2238: Multiple declaration for '~Matcher<std::string>::Matcher()'
..\include\gmock/gmock-matchers.h(319): error E2344: Earlier declaration of '~Matcher<std::string>::Matcher()'
..\include\gmock/gmock-spec-builders.h(1363): error E2468: Value of type void is not allowed
..\include\gmock/gmock-spec-builders.h(1373): error E2238: Multiple declaration for 'ActionResultHolder<void>::GetValueAndDelete() const'
..\include\gmock/gmock-spec-builders.h(1329): error E2344: Earlier declaration of 'ActionResultHolder<void>::GetValueAndDelete() const'
..\include\gmock/gmock-spec-builders.h(1375): error E2238: Multiple declaration for 'ActionResultHolder<void>::PrintAsActionResult(ostream *) const'
..\include\gmock/gmock-spec-builders.h(1336): error E2344: Earlier declaration of 'ActionResultHolder<void>::PrintAsActionResult(ostream *) const'
..\include\gmock/gmock-generated-function-mockers.h(866): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(868): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(877): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(879): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(888): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(890): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(899): error E2272: Identifier expected
..\include\gmock/gmock-generated-function-mockers.h(901): error E2321: Declaration does not specify a tag or an identifier
..\include\gmock/gmock-generated-function-mockers.h(901): error E2228: Too many error or warning messages

0 Warning(s)
51 Error(s)

Time Elapsed 00:00:01.23

可以找到我正在尝试编译的源代码 here ,该项目位于 src 文件夹中。

最佳答案

问题解决了。看来32位编译器有问题,需要用64位编译器编译库。

关于c++ - C++ Builder 的 GoogleMock 编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21575551/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com