Problem using GMock with VS2010 and C++/CLI

422 views
Skip to first unread message

Sean

unread,
Mar 30, 2011, 11:49:19 AM3/30/11
to Google C++ Mocking Framework
Hi all

Our product previously built in Visual Studio 2008 and used GoogleMock
1.5.0.

Now, after porting our product to Visual Studio 2010, any unit test
DLL that uses GoogleMock will not load in visual Studio's Test View
and consequently can't be executed.

Our production code is written in native C++ classes exported from C++
DLLs.

Our unit tests are written in C++/CLI so they can be hosted directly
within Visual Studio. The C++/CLI unit tests exercise our native C++
classes and GoogleMocks previously played quite happily in this
scenario.

We build GoogleMock into static libs that use Multithreaded DLL. All
our production code also uses Multithreaded DLL.

I have tried GMock 1.5 and 1.6 RC, both rebuilt within VS2010. But the
problem arises with both versions of GMock.

To reproduce, simply
(1) Create a new C++ Unit Test project
(2) add gmock.lib and gmock_main.lib as linker inputs
(3) #include <gmock/gmock.h> at the top of the C++/CLI unit test
header file.

The project will build fine, but the VS Test View cannot load the new
unit test DLL.

I am hoping that another VS2010 developer has encountered this problem
and can suggest a fix.

My set-up:
- Windows 7 x64
- Visual Studio 2010, Service Pack 1
- GoogleMock 1.5, or 1.6 RC
- Our app is built as 32-bit.

Thanks.

Sean

unread,
Mar 30, 2011, 12:00:03 PM3/30/11
to Google C++ Mocking Framework
On Mar 30, 4:49 pm, Sean <seandy...@gmail.com> wrote:
> Now, after porting our product to Visual Studio 2010, any unit test
> DLL that uses GoogleMock will not load in visual Studio's Test View
> and consequently can't be executed.

I should also add that all our C++ code, including GoogleMock, is
compiled using VS2010's vc100 compiler (C++0x). Our C++/CLI code is
also built for .NET 4.0.

Benjamin Mukasa

unread,
Jan 23, 2015, 8:58:14 PM1/23/15
to googl...@googlegroups.com
Sean,

No one answered your question but I am facing a similar problem right now. I want to use Google Mock with the default unit testing framework in Visual Studio 2013.
Did you solve the problem or could you offer any other advice on setting this up?

Ben
Reply all
Reply to author
Forward
0 new messages