[Kstars-devel] HTM compilation
James Bowlin
bowlin at mindspring.com
Fri May 26 21:11:01 CEST 2006
I was able to get HTM to compile with gcc-3.4.5 by commenting out just one
line in the source files. I think we just need to fix this one line.
Here it is:
src/SpatialInterface.cpp:538-539:
//was: polyCorners_.insert(polyCorners_.end() - i - 1);
polyCorners_.insert(polyCorners_.end() - i - 1);
The comment was already there in the code but it is the exact same code.
It looks like they fixed it and then broke it again.
Here is the error message (with some whitespace added by me):
src/SpatialInterface.cpp: In member function `void
htmInterface::setPolyCorner(SpatialVector&)':
src/SpatialInterface.cpp:539: error: no matching function for call to
`std::vector<htmPolyCorner, std::allocator<htmPolyCorner> >::insert
(__gnu_cxx::__normal_iterator<htmPolyCorner*, std::vector<htmPolyCorner,
std::allocator<htmPolyCorner> > >)'
/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3/bits/vector.tcc:92:
note: candidates are:
typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp,
_Alloc>::insert
(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp,
_Alloc> >, const _Tp&)
[with _Tp = htmPolyCorner, _Alloc = std::allocator<htmPolyCorner>]
/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/include/g++-v3/bits/stl_vector.h:612:
note:
void std::vector<_Tp, _Alloc>::insert
(__gnu_cxx::__normal_iterator<typename _Alloc::pointer, std::vector<_Tp,
_Alloc> >, size_t, const _Tp&)
[with _Tp = htmPolyCorner, _Alloc = std::allocator<htmPolyCorner>]
make: *** [unix/SpatialInterface.o] Error 1
There was a similar call to insert() in the same file:
src/SpatialInterface.cpp:478:
polyCorners_.insert(polyCorners_.end(), polyCorners_[1]);
// GYF polyCorners_[1] was missing!!!!
It seems pretty clear to me that we need to add a second argument to the
insert() call on the line that is failing. I added ,polyCorners_[1] like
GYF did for the previous call but I have no idea if this is correct or not.
The code did compile and "make runtest" gave the proper results.
As a sanity check, I commented out a vital line of code nearby.
Unfortunately, the code still ran and passed runtest. So then I added
an exit(17); to this block of code and it still ran properly and passed
runtest. I conclude that this part of the code is not exercised in the
runtest tests. I don't know when this code is used. Perhaps I should
leave the exit() call in there, preceded by a warning to STDERR so we
will at least know when this comes back to bite us. Suggestions?
BTW: I added -Wno-deprecated to the CFLAGS in the makefile to reduce
warnings. Also, I don't have csh on my system so I manually ran the
following code from ./configure to generate a Linux makefile:
sed -f linux.sed < Makefile.generic > Makefile
My next task will be to write a Perl wrapper for these libs so they are
easier to play with.
--
Peace, James
More information about the Kstars-devel
mailing list