Проблемы компиляции GoogleMock с C++ Builder
У меня возникают некоторые проблемы при попытке скомпилировать (и использовать) библиотеку 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
Источники, которые я пытаюсь скомпилировать, можно найти здесь, проект находится внутри src
папка.
1 ответ
Задача решена. Кажется, что у 32-битного компилятора есть некоторые проблемы. Необходимо было скомпилировать библиотеку с 64- битным компилятором.