Advice on undefined reference to `Integral::operator int() const' error in 11400.cc test

Karl Lindstrom karllindstrom@mac.com
Sun Jul 6 18:57:00 GMT 2008


Ok thanks, I will look into it.

I had one more question here:

I am running the test file:

25_algorithms\search_n\11400.cc

And get this error:

c:\blunk\tools\2008.0\source-blunk\tests\c++testsuite\runone\output 
\m68k-elf\m547x\runner\11400.o: In function `int*  
std::__search_n<int*, Integral, int, std::greater<int> >(int*, int*,  
Integral, int const&, std::greater<int>,  
std::random_access_iterator_tag)':
C:/Blunk/tools/2008.0/gnu/m68k-elf/include/c++/4.1.1/bits/stl_algo.h: 
788: undefined reference to `Integral::operator int() const'
c:\blunk\tools\2008.0\source-blunk\tests\c++testsuite\runone\output 
\m68k-elf\m547x\runner\11400.o: In function `int* std::search_n<int*,  
Integral, int, std::greater<int> >(int*, int*, Integral, int const&,  
std::greater<int>)':
C:/Blunk/tools/2008.0/gnu/m68k-elf/include/c++/4.1.1/bits/stl_algo.h: 
850: undefined reference to `Integral::operator int() const'
C:/Blunk/tools/2008.0/gnu/m68k-elf/include/c++/4.1.1/bits/stl_algo.h: 
852: undefined reference to `Integral::operator int() const'
c:\blunk\tools\2008.0\source-blunk\tests\c++testsuite\runone\output 
\m68k-elf\m547x\runner\11400.o: In function `int*  
std::__search_n<int*, Integral, int>(int*, int*, Integral, int  
const&, std::random_access_iterator_tag)':
C:/Blunk/tools/2008.0/gnu/m68k-elf/include/c++/4.1.1/bits/stl_algo.h: 
662: undefined reference to `Integral::operator int() const'
c:\blunk\tools\2008.0\source-blunk\tests\c++testsuite\runone\output 
\m68k-elf\m547x\runner\11400.o: In function `int* std::search_n<int*,  
Integral, int>(int*, int*, Integral, int const&)':
C:/Blunk/tools/2008.0/gnu/m68k-elf/include/c++/4.1.1/bits/stl_algo.h: 
720: undefined reference to `Integral::operator int() const'
c:\blunk\tools\2008.0\source-blunk\tests\c++testsuite\runone\output 
\m68k-elf\m547x\runner\11400.o:C:/Blunk/tools/2008.0/gnu/m68k-elf/ 
include/c++/4.1.1/bits/stl_algo.h:722: more undefined references to  
`Integral::operator int() const' follow


Any insight into what is going on here, would be much appreciated:
I look at line 788 in gnu/m68k-elf/include/c++/4.1.1/bits/stl_algo.h
and see:

   template<typename _RandomAccessIter, typename _Integer, typename _Tp,
	   typename _BinaryPredicate>
     _RandomAccessIter
     __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
	       _Integer __count, const _Tp& __val,
	       _BinaryPredicate __binary_pred, std::random_access_iterator_tag)
     {

       typedef typename  
std::iterator_traits<_RandomAccessIter>::difference_type
	_DistanceType;

       _DistanceType __tailSize = __last - __first;
       const _DistanceType __pattSize = __count;   //  
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< line 788

       if (__tailSize < __pattSize)
         return __last;

       const _DistanceType __skipOffset = __pattSize - 1;
       _RandomAccessIter __lookAhead = __first + __skipOffset;
       __tailSize -= __pattSize;

       while (1) // the main loop...
	{
	  // __lookAhead here is always pointing to the last element of next
	  // possible match.
	  while (!__binary_pred(*__lookAhead, __val)) // the skip loop...
	    {
	      if (__tailSize < __pattSize)
		return __last;  // Failure
	      __lookAhead += __pattSize;
	      __tailSize -= __pattSize;
	    }
	  _DistanceType __remainder = __skipOffset;
	  for (_RandomAccessIter __backTrack = __lookAhead - 1;
	       __binary_pred(*__backTrack, __val); --__backTrack)
	    {
	      if (--__remainder == 0)
		return (__lookAhead - __skipOffset); // Success
	    }
	  if (__remainder > __tailSize)
	    return __last; // Failure
	  __lookAhead += __remainder;
	  __tailSize -= __remainder;
	}
     }

And I am really looking for any advice on where to start looking to  
resolve
this error message.

Thanks.

-Karl



More information about the Libstdc++ mailing list