new guy cpputest setup with eclipse

905 views
Skip to first unread message

Dainius Narsutis

unread,
Aug 19, 2016, 9:38:36 AM8/19/16
to cpputest
Hi everyone,

I am trying to get into TDD (I've read J Greening's book) and need to set up eclipse with cpputest. I've got an existing project and I would like to add unit tests for it. I cannot find any reasonable information for someone that is new at getting the project setup. I've got the cpputest compiled and built from github. Could anyone point me in a direction of a full tutorial/guide which can explain things in step by step?

Much appreciated.

James Grenning

unread,
Aug 19, 2016, 10:28:48 AM8/19/16
to cpputest
Hello Dainius

I suggest you start with a simple working example, then keep it working
by adding your code incrementally.

Here is my starter kit:
https://github.com/jwgrenning/cpputest-starter-project. Note that the
CppUTest installation instructions is different for my starter project
than described on the cpputest.org

Here is a recipe for pulling existing code into a test harness:
https://wingman-sw.com/articles/tdd-legacy-c

Regarding eclipse, I suggest you start with the command line and the
starter project makefile, then later integrate with eclipse. You will
want to import existing makefile project into eclipse and not let
eclipse manage your makefile.

Hope that helps

James

--------------------------------------------------------------------------
James Grenning - Author of TDD for Embedded C - wingman-sw.com/tddec
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
[![wingman
software](http://www.wingman-sw.com/images/wingman.png)](http://wingman-sw.com)
> --
> 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.

Dainius Narsutis

unread,
Aug 19, 2016, 10:35:03 AM8/19/16
to cpputest
Hi James,

Thanks for the links. I am really close to getting something working, but keep getting this error: C:\ProjectFiles\cpputest\lib\libCppUTest.a: error adding symbols: File format not recognized

Thanks.

James Grenning

unread,
Aug 19, 2016, 10:39:49 AM8/19/16
to cpputest
What compiler are you using? Sounds like you might be cross compiling.
CppUTest's libraries must be built with the same compiler and target
platform.

Does CppUTest build and run its tests?

James

--------------------------------------------------------------------------
James Grenning - Author of TDD for Embedded C - wingman-sw.com/tddec
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
[![wingman
software](http://www.wingman-sw.com/images/wingman.png)](http://wingman-sw.com)
>> wingman-sw.com <http://wingman-sw.com/tddecwingman-sw.com>
>>> an email to cpputest+u...@googlegroups.com <javascript:>.

Dainius Narsutis

unread,
Aug 19, 2016, 12:51:13 PM8/19/16
to cpputest
Ah that may be my problem. I followed the guide in the Readme file to build cpputest via Cygwin in Windows.
In eclipse I've created C++ project and which is using arm-none-eabi-g++.

James Grenning

unread,
Aug 19, 2016, 2:29:21 PM8/19/16
to cpputest
I suggest you start from the command line getting the starter project to
compile with cygwin.

After you have stuff working in cygwin, you can optionally look at also
running your tests on target.

James

On 19 Aug 2016, at 11:51, Dainius Narsutis wrote:

> Ah that may be my problem. I followed the guide in the Readme file to
> build
> cpputest via Cygwin in Windows.
> In eclipse I've created C++ project and which is using
> arm-none-eabi-g++.
>
>
>
> On Friday, 19 August 2016 15:39:49 UTC+1, James Grenning wrote:
>>
>> What compiler are you using? Sounds like you might be cross
>> compiling.
>> CppUTest's libraries must be built with the same compiler and target
>> platform.
>>
>> Does CppUTest build and run its tests?
>>
>> James
>>
>> --------------------------------------------------------------------------
>> James Grenning - Author of TDD for Embedded C - wingman-sw.com/tddec

Dainius Narsutis

unread,
Aug 20, 2016, 4:48:39 AM8/20/16
to cpputest
Thanks. I am working through your PDF found in the starter project. Step 3 is giving me an error:

Dainius Narsutis@DESKTOP-O03I4FL /cygdrive/c/Projects/cpputest-starter-project
$ make all
compiling io_CppUMock.cpp
In file included from <command-line>:0:0:
/cygdrive/c/Projects/cpputest-3.8/include/CppUTest/MemoryLeakDetectorNewMacros.h:45:10: error: ‘void operator delete(void*, size_t)’ is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Werror=c++14-compat]
     void operator delete (void* mem, size_t size) UT_NOTHROW;
          ^
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
make: *** [/cygdrive/c/Projects/cpputest-3.8/build/MakefileWorker.mk:504: test-obj/tests/io-cppumock/io_CppUMock.o] Error 1

I know my CPPUTEST_HOME variable works too because I can type CppUTestTests into command-line and the tests run.

Dainius

keto....@gmail.com

unread,
Nov 4, 2016, 4:01:09 AM11/4/16
to cpputest
Hi,

I'm also stuck in step 3 getting the same error. Using cygwin on 64-bit Win 7. No prior experience with cpputest (never used c++ either, purely embedded C) so any tips on how to move on would be really appreciated.

Thanks! 
Reply all
Reply to author
Forward
0 new messages