Build failure with VS2015

1,134 views
Skip to first unread message

Saad Ur Rahman

unread,
Oct 5, 2015, 11:08:46 AM10/5/15
to Google C++ Mocking Framework
Hi,

I am trying to get GMock running in VS2015 and have run into a build error whilst running the included <.sln> in the msvc/2010 directory. The <gmock> and <gmock_main> components build just fine, creating the the <gmock.lib> and <gmock_main.lib> files in the debug directory. What fails to build is the <gmock_test> component, giving me the warnings and errors below:

1>------ Build started: Project: gmock_test, Configuration: Debug Win32 ------
1>  gmock_all_test.cc
1>Visual Studio 2015\Projects\GoogleMock\test/gmock-generated-function-mockers_test.cc(134): warning C4373: 'testing::gmock_generated_function_mockers_test::MockFoo::TakesConst': virtual function overrides 'testing::gmock_generated_function_mockers_test::FooInterface::TakesConst', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
1>  Visual Studio 2015\Projects\GoogleMock\test/gmock-generated-function-mockers_test.cc(91): note: see declaration of 'testing::gmock_generated_function_mockers_test::FooInterface::TakesConst'
1>Visual Studio 2015\Projects\GoogleMock\include\gmock/gmock-matchers.h(530): error C2440: 'return': cannot convert from 'testing::internal::EqMatcher<testing::gmock_matchers_test::ConvertibleFromAny>' to 'testing::Matcher<testing::gmock_matchers_test::ConvertibleFromAny>'
1>  Visual Studio 2015\Projects\GoogleMock\include\gmock/gmock-matchers.h(530): note: No constructor could take the source type, or constructor overload resolution was ambiguous
1>  Visual Studio 2015\Projects\GoogleMock\include\gmock/gmock-matchers.h(521): note: while compiling class template member function 'testing::Matcher<testing::gmock_matchers_test::ConvertibleFromAny> testing::internal::MatcherCastImpl<T,M>::CastImpl(M,testing::internal::BooleanConstant<true>)'
1>          with
1>          [
1>              T=testing::gmock_matchers_test::ConvertibleFromAny,
1>              M=testing::internal::EqMatcher<testing::gmock_matchers_test::ConvertibleFromAny>
1>          ]
1>  Visual Studio 2015\Projects\GoogleMock\include\gmock/gmock-matchers.h(509): note: see reference to function template instantiation 'testing::Matcher<testing::gmock_matchers_test::ConvertibleFromAny> testing::internal::MatcherCastImpl<T,M>::CastImpl(M,testing::internal::BooleanConstant<true>)' being compiled
1>          with
1>          [
1>              T=testing::gmock_matchers_test::ConvertibleFromAny,
1>              M=testing::internal::EqMatcher<testing::gmock_matchers_test::ConvertibleFromAny>
1>          ]
1>  Visual Studio 2015\Projects\GoogleMock\include\gmock/gmock-matchers.h(586): note: see reference to class template instantiation 'testing::internal::MatcherCastImpl<T,M>' being compiled
1>          with
1>          [
1>              T=testing::gmock_matchers_test::ConvertibleFromAny,
1>              M=testing::internal::EqMatcher<testing::gmock_matchers_test::ConvertibleFromAny>
1>          ]
1>  Visual Studio 2015\Projects\GoogleMock\test/gmock-matchers_test.cc(634): note: see reference to function template instantiation 'testing::Matcher<testing::gmock_matchers_test::ConvertibleFromAny> testing::MatcherCast<testing::gmock_matchers_test::ConvertibleFromAny,testing::internal::EqMatcher<testing::gmock_matchers_test::ConvertibleFromAny>>(M)' being compiled
1>          with
1>          [
1>              M=testing::internal::EqMatcher<testing::gmock_matchers_test::ConvertibleFromAny>
1>          ]
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========


Any help resolving this would be greatly appreciated.


Thanks,
/Saad

Samuel Benzaquen

unread,
Oct 6, 2015, 5:28:31 PM10/6/15
to Saad Ur Rahman, Google C++ Mocking Framework
Which version are you using?
Is there a way to get more detail wrt error "No constructor could take the source type, or constructor overload resolution was ambiguous"?
If it was ambiguous, can we get the list of candidates?

Thanks, Sam

--

---
You received this message because you are subscribed to the Google Groups "Google C++ Mocking Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlemock+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/googlemock/ad7652e0-caee-4062-be91-7bc2ff33c8ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Saad Ur Rahman

unread,
Oct 7, 2015, 10:51:10 AM10/7/15
to Google C++ Mocking Framework, saad.ur...@gmail.com
Hi Sam,

I am building GMock 1.7.0 using VSEnt 2015. Intellisense isn't giving me a list of potential fix candidates for the error.. Is there anything you'd like to me try out?


Thanks,
Saad 

Samuel Benzaquen

unread,
Oct 14, 2015, 1:50:50 PM10/14/15
to Saad Ur Rahman, Google C++ Mocking Framework
Can you try with trunk?
Maybe the problem is already fixed.

Jitender Kumar

unread,
Oct 30, 2015, 7:52:11 AM10/30/15
to Google C++ Mocking Framework

I wanted to build gtest using clearcase omake building tool. I searched a lot but did not get the right answer. Can anybody please help me in that?

Saad

unread,
Dec 9, 2015, 4:06:35 PM12/9/15
to Samuel Benzaquen, Google C++ Mocking Framework
Hi Sam,

Problem is resolved on the latest build using MSVC14. I'll try and build with ICL/ICPC and report back on any changes I've had to make.


Thanks,
Saad

Saad Ur Rahman

unread,
Dec 9, 2015, 4:06:37 PM12/9/15
to Google C++ Mocking Framework
Hi Jitender,

If you'd like to use a make tool I'd suggest just going with CMake, the CMakeList file is already setup. Just run "cmake -Dgtest_build_samples=ON" from inside the Google Mock directory. This will prepare all the files for you to build from inside your native copy of MSVC.


/Saad

User

unread,
Jan 19, 2016, 8:49:32 PM1/19/16
to Google C++ Mocking Framework
What does the  -Dgtest_build_samples=ON option do?

Saad

unread,
Feb 10, 2016, 1:15:25 AM2/10/16
to Google C++ Mocking Framework
It builds all the sample tests for you, they are example tests included to help you get started.

Saad

unread,
Feb 10, 2016, 1:27:02 AM2/10/16
to Google C++ Mocking Framework
It should also help to check that the Google Mock library compiled correctly. Also note that some testing frameworks like CPPUTest run the test when you hit build, GMock requires you to run the test runner.
Reply all
Reply to author
Forward
0 new messages