3 ms·
I wrote a C++ implementation of the AMBER force field in 2003. Still have the source code with its original modification times. Let's see: /usr/bin/g++ -
by dekhn 6y ago
I wrote a C++ implementation of the AMBER force field in 2003. Still have the source code with its original modification times. Let's see:
/usr/bin/g++ -I/home/dek/sw/rh9/gsl-1.3/include -c -o NBEnergy.o NBEnergy.cpp
NBEnergy.cpp: In member function ‘virtual double NBEnergy::Calculate(Coordinates&, std::vector<Force*>)’:
NBEnergy.cpp:20:68: error: no matching function for call to ‘find(std::vector<atom*>::const_iterator, std::vector<atom*>::const_iterator, const atom*&)’
20 | if (std::find(at1->Excluded.begin(), at1->Excluded.end(), at2) != at1->Excluded.end())
{
| ^
In file included from /usr/include/c++/9/bits/locale_facets.h:48,
from /usr/include/c++/9/bits/basic_ios.h:37,
from /usr/include/c++/9/ios:44,
from /usr/include/c++/9/ostream:38,
from GeneralParameters.h:6,
from NBEnergy.h:6,
from NBEnergy.cpp:1:
/usr/include/c++/9/bits/streambuf_iterator.h:373:5: note: candidate: ‘template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)’
373 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/9/bits/streambuf_iterator.h:373:5: note: template argument deduction/substitution failed:
NBEnergy.cpp:20:68: note: ‘__gnu_cxx::__normal_iterator<atom* const*, std::vector<atom*> >’ is not derived from ‘std::istreambuf_iterator<_CharT>’
20 | if (std::find(at1->Excluded.begin(), at1->Excluded.end(), at2) != at1->Excluded.end())
{
| ^
make: *** [<builtin>: NBEnergy.o] Error 1
I still have a hardcoded reference to RedHat 9 apparently.
But the only error has to do with an iterator, so clearly, something in C++ changed. Looks like a 1-2 line change.
- josefx 6y agoYou probably didn't include the algorithm header that defines find directly and it stopped compiling once the standard library maintainers cleaned up their own includes. The iostreams headers you include define their own stream iterator specific overload of find and that doesn't match.
- dekhn 6y agoYup, that was it. After that, I had to install libpython27-dev, and add -fPIC. Then my 17 year old Python module that has linked-in C++ code runs just fine. I'm not surprised- I've been writing cross-platform code that runs for 10+ years for 20+ years.