[Libpqxx-general] Building the cvs version with Visual Studio 9 - fix for pipeline.cxx

Richard B. Kreckel kreckel at ginac.de
Fri Jun 13 21:55:54 UTC 2008


Jeroen Vermeulen wrote:
> Andrew Maclean wrote:
>> I am building with VS 9 and postgresql 8.8.3. You need a minor fix to
>> the file pipeline.cxx
>>
>> The build works provided that in the file pipeline.cxx you replace
>> distance in lines 206 and 315 with std::distance. This function is no
>> longer in the anonymous namespace.
> 
> It's not supposed to be in the anonymous namespace, except as a 
> workaround for std not having one.  So it sounds more likely that you 
> ran into a conflict, where two conflicting versions of distance() were 
> available.  I think the appropriate way to fix the problem is to make 
> the headers note that this particular compiler has std::distance().
> 
> To verify, does the problem go away when you #define PQXX_HAVE_DISTANCE?

I'm seeing the same problem with current SVN and g++-4.1.1. Regarding 
the definitino of PQXX_HAVE_DISTANCE: it goes awat if I define it, but 
it also appears like <pqxx/config.h> does not get included when 
pipeline.cxx is being compiled. Here's the compiler error message:

pipeline.cxx: In member function 'void pqxx::pipeline::issue()':
pipeline.cxx:206: error: call of overloaded 
'distance(std::_Rb_tree_iterator<std::pair<const long int, 
pqxx::pipeline::Query> >&, std::_Rb_tree_iterator<std::pair<const long 
int, pqxx::pipeline::Query> >)' is ambiguous
pipeline.cxx:36: note: candidates are: 
size_t<unnamed>::distance(ITERATOR, ITERATOR) [with ITERATOR = 
std::_Rb_tree_iterator<std::pair<const long int, pqxx::pipeline::Query> >]
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h:114: 
note:                 typename 
std::iterator_traits<_Iterator>::difference_type 
std::distance(_InputIterator, _InputIterator) [with _InputIterator = 
std::_Rb_tree_iterator<std::pair<const long int, pqxx::pipeline::Query> >]
pipeline.cxx: In member function 'void pqxx::pipeline::obtain_dummy()':
pipeline.cxx:315: error: call of overloaded 
'distance(std::_Rb_tree_iterator<std::pair<const long int, 
pqxx::pipeline::Query> >&, const std::_Rb_tree_iterator<std::pair<const 
long int, pqxx::pipeline::Query> >&)' is ambiguous
pipeline.cxx:36: note: candidates are: 
size_t<unnamed>::distance(ITERATOR, ITERATOR) [with ITERATOR = 
std::_Rb_tree_iterator<std::pair<const long int, pqxx::pipeline::Query> >]
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h:114: 
note:                 typename 
std::iterator_traits<_Iterator>::difference_type 
std::distance(_InputIterator, _InputIterator) [with _InputIterator = 
std::_Rb_tree_iterator<std::pair<const long int, pqxx::pipeline::Query> >]

Cheers
   -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the Libpqxx-general mailing list