[Cppunit-devel] Issues with Money example using Cygwin on Windows XP
Brought to you by:
blep
|
From: Rick G. <Ric...@na...> - 2005-12-14 22:46:13
|
Dear CppUnit Developers;
I am trying to get CppUnit up and running on my machine (and hopefully
integrated with Eclipse at some point), and have had several issues in
trying to work through the Cookbook and Money example. I'm coming from
doing Java development with Eclipse to doing C/C++, and I'd like to have
the same tools available, that is, unit testing, refactoring, etc.
Hence the interest in CppUnit with Eclipse. However, I am a newbie to
the GNU toolchain, so please feel free to point me to where these issues
may already be documented.
=20
Since the Cookbook example does not provide any information on
tool/envrionment setup, I switched to the Money example, and ran across
the following six issues:
=20
1.) Warnings from aclocal:
Running aclocal using the configure.in from the Money example gave the
following warnings:
/usr/share/aclocal/libsmi.m4:8: warning: underquoted definition of
AM_PATH_LIBSMI
run info '(automake)Extending aclocal'
or see
http://sources.redhat.com/automake/automake.html#Extending-aclocal
/usr/share/aclocal/cppunit.m4:4: warning: underquoted definition of
AM_PATH_CPPUNIT
I didn't know if these could be ignored or not. It seems they can be
ignored, but perhaps either the quoting level can be fixed, or a note
added to the Money example that these warnings can be ignored.
2.) MoneyApp.cpp compile error:
MoneyApp.cpp:1:20: stdafx.h: No such file or directory
=20
I don't have stdafx.h on my system anywhere. Removing the line allowed
compilation to complete. Is this line required? Should stdafx.h be
part of Cygwin or Windows XP or CppUnit? Perhaps a comment or
appropriate #ifdef in the code could be added?
3.) Error from g++:
Using the configure.in and Makefile.am provided in the Money example to
generate the Makefile, make check gave the following error:
g++ -g -O2 -o MoneyApp.exe -ldl MoneyApp-MoneyTest.o
MoneyApp-MoneyApp.o =20
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
cannot find -ldl
I found a reference on the Internet that "-ldl" was for Linux, and could
be ignored on Cygwin. If this is true, this should be documented on the
example page.
4.) Duplicate definition in Makefile.am?:
Following the previous issue, I noticed that MoneyApp_LDFLAGS is defined
twice in Makefile.amas shown in the example:
MoneyApp_LDFLAGS =3D $(CPPUNIT_LIBS)
MoneyApp_LDFLAGS =3D -ldl
Is this correct?
5.) Incorrect order of link library option?:
After removing the "MoneyApp_LDFLAGS =3D -ldl" line from Makefile.am and
rebuilding the Makefile, make check then gives a bunch of undefined
references, starting with:
g++ -g -O2 -o MoneyApp.exe -lcppunit MoneyApp-MoneyTest.o
MoneyApp-MoneyApp.o =20
MoneyApp-MoneyApp.o: In function `main':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/ext/new_allocator.h:62:
undefined reference to
`CppUnit::TestFactoryRegistry::getRegistry(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
In looking into this, the "-lcppunit" should occur after the list of
object files. So in the Makefile, it should be part of the LIBS
definition, not the MoneyApp_LDFLAG definition. Is this perhaps a
problem in Makefile.am?
6.) Segmentation fault:
After tweaking the Makefile to put the "-lcppunit" after the object
files, make check completed and ran, but with a segmentation fault:
g++ -g -O2 -o MoneyApp.exe MoneyApp-MoneyTest.o
MoneyApp-MoneyApp.o -lcppunit
make[1]: Leaving directory `/home/rgould/money'
make check-TESTS
make[1]: Entering directory `/home/rgould/money'
OK (/bin/sh: line 1: 1592 Segmentation fault (core dumped)
${dir}$tst
FAIL: MoneyApp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
1 of 1 tests failed
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
make[1]: *** [check-TESTS] Error 1
make[1]: Leaving directory `/home/rgould/money'
make: *** [check-am] Error 2
Note that this is using MoneyApp.cpp as first presented in the example
(minus the #include "stdafx.h") - no test fixture or tests as added
later in the example.
I am running Cygwin 1.5.18-1 (with CppUnit 1.9.14-1) on Windows XP
Professional Version 2002, Service Pack 1.
If these are legitimate issues, perhaps the Money example page can be
updated accordingly. If it is a matter of my ignorance, perhaps adding
some notes to the Money example where other newbies can go learn the
background necessary to run the example.
Regards,=20
Rick Gould
Senior Software Developer
DDI: +64 9 442 8790
Navman New Zealand
7-21 Kawana Street, Northcote=20
PO Box. 68 155 Newton=20
Auckland, New Zealand
TEL: +64 9 481 0500
FAX: +64 9 480 3176
http://www.navman.com
Designers & Manufacturers of GPS, Communication and Marine Products
=20
This email (including any attachments) is confidential, may be
privileged and contain rights that belong to Navman New Zealand. Any
unauthorised use of this email is expressly prohibited. If you have
received this email in error, please notify the sender immediately by
return email, fax or phone and then delete all copies of this email and
any attachments to it. This email does not necessarily reflect the views
of Navman New Zealand.
To the maximum extent permitted by law, Navman New Zealand will not be
liable in any way (including in respect of negligence) for viruses and
other defects or changes made to this email or any attachments to it
after transmission from Navman New Zealand.
|