cpputest under visual studio in windows

1,426 views
Skip to first unread message

Husam Ibrahim

unread,
Jul 22, 2014, 4:03:45 PM7/22/14
to cppu...@googlegroups.com
I'm currently trying to get the latest cpputest (version 3.6) to work under visual studio in windows. I started by going to the following link:

I downloaded visual studio express 2013, cpputest as well as cmake. However, I'm stuck at this step:

Then to get started, you'll need to do the following:
  • Add the include path to the Makefile. Something like:
    • CPPFLAGS += -I(CPPUTEST_HOME)/include
  • Add the memory leak macros to you Makefile (needed for additional debug info!). Something like:
    • CXXFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h
    • CFLAGS += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h
  • Add the library linking to your Makefile. Something like:
    • LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
I'm unsure as to how to modify cmakelists.txt to include the above information.

Any help would be appreciated.

Regards,
Husam



Martin Ertsås

unread,
Jul 23, 2014, 1:31:39 AM7/23/14
to cppu...@googlegroups.com
Those are only relevant for Makefile targets. On windows we will create visual studio project files. I'm not really familiar with visual studio, but you have to make your project, the one with the tests, add the (CPPUTEST_HOME)/include folder to the include path. You also need to link against cpputest and cpputestext. 

- Martin
--
You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

A. Robert S.

unread,
Jul 23, 2014, 9:41:42 AM7/23/14
to cppu...@googlegroups.com
Hi Husam,
 
You don't need cmake for building with Visual Studio. In CppUTest, you will find CppUTest_VS2010.sln. Open this with VC2013 and build the two projects contained therein. This should give you the CppUTest library and run the associated test cases.
 
Robert

Husam Ibrahim

unread,
Jul 23, 2014, 4:20:21 PM7/23/14
to cppu...@googlegroups.com
Hi Robert,

Thanks for the suggestion. I tried building the projects within CppUTest_VS2010.sln but ran into build errors (please see attached screenshot).
I should mention that I'm using Visual Studio Express 2013 with CppUTest 3.6

Is it worth trying an earlier version of visual studio and/or CppUTest?

Regards,
Husam
cpputest.jpg

James Grenning

unread,
Jul 23, 2014, 5:04:33 PM7/23/14
to cppu...@googlegroups.com
Husam

You can fix that easily. Either create a lib\vs2010 directory, or
remove the post-build event from the solution file settings. You might
also have to adjust where the test runner console app gets its library.
I put that copy in there years ago when I was trying to have several
cpputest libraries in the same machine for different VS versions.

I think that could be removed from the settings, as my need was pretty
special, and now nonexistent.

James
>>> - Add the include path to the Makefile. Something like:
>>> - CPPFLAGS += -I(CPPUTEST_HOME)/include
>>> - Add the memory leak macros to you Makefile (needed for additional
>>> debug info!). Something like:
>>> - CXXFLAGS += -include
>>> $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h
>>> - CFLAGS += -include
>>>
>>> $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h
>>> - Add the library linking to your Makefile. Something like:
>>> - LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
>>>
>>> I'm unsure as to how to modify cmakelists.txt to include the above
>>> information.
>>>
>>> Any help would be appreciated.
>>>
>>> Regards,
>>> Husam
>>>
>>>
>>>
>>>
>
> --
> You received this message because you are subscribed to the Google
> Groups "cpputest" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cpputest+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> [cpputest.jpg]
Reply all
Reply to author
Forward
0 new messages