Missing header in /Source/ViewIsochrons.cc
Hi there,
while trying to compile garfieldpp
in centos with gcc version 6.2.0 (GCC),
i had issues compiling /Source/ViewIsochrons.cc
(log file given at the bottom).
those issues were not observed when compiling on Fedora with gcc version 9.1.1 20190503 (Red Hat 9.1.1-1) (GCC).
The issue seems to be resolved with:
diff --git a/Source/ViewIsochrons.cc b/Source/ViewIsochrons.cc
index 205e405..360d112 100644
--- a/Source/ViewIsochrons.cc
+++ b/Source/ViewIsochrons.cc
@@ -1,3 +1,4 @@
+#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
best wishes,
Kostas
Building CXX object garfieldpp/CMakeFiles/Garfield.dir/Source/ViewIsochrons.cc.o
cd /home/kn/simg4/build/garfieldpp && /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++ -DGarfield_EXPORTS -isystem /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.14.04-820c6/x86_64-centos7-gcc62-opt/include -I/home/kn/simg4/simulationg4/garfieldpp/Include -I/home/kn/simg4/simulationg4/garfieldpp/Heed -Wall -Wextra -pedantic -ansi -Wabi -Wno-long-long -Woverloaded-virtual -fno-common -pg -O3 -DNDEBUG -fPIC -std=c++14 -o CMakeFiles/Garfield.dir/Source/ViewIsochrons.cc.o -c /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc: In function ‘double {anonymous}::Interpolate(const std::vector<double>&, const std::vector<double>&, double)’:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:24:20: error: ‘upper_bound’ is not a member of ‘std’
const auto it1 = std::upper_bound(x.cbegin(), x.cend(), xx);
^~~
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc: In function ‘bool {anonymous}::OnLine(double, double, double, double, double, double)’:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:36:64: error: no matching function for call to ‘max(<brace-enclosed initializer list>)’
double epsx = 1.e-10 * std::max({fabs(x1), fabs(x2), fabs(u)});
^
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/char_traits.h:39:0,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ios:40,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ostream:38,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/iostream:39,
from /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:2:
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^~~
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:36:64: note: candidate expects 2 arguments, 1 provided
double epsx = 1.e-10 * std::max({fabs(x1), fabs(x2), fabs(u)});
^
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/char_traits.h:39:0,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ios:40,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ostream:38,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/iostream:39,
from /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:2:
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:36:64: note: candidate expects 3 arguments, 1 provided
double epsx = 1.e-10 * std::max({fabs(x1), fabs(x2), fabs(u)});
^
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:37:64: error: no matching function for call to ‘max(<brace-enclosed initializer list>)’
double epsy = 1.e-10 * std::max({fabs(y1), fabs(y2), fabs(v)});
^
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/char_traits.h:39:0,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ios:40,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ostream:38,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/iostream:39,
from /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:2:
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^~~
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:37:64: note: candidate expects 2 arguments, 1 provided
double epsy = 1.e-10 * std::max({fabs(y1), fabs(y2), fabs(v)});
^
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/char_traits.h:39:0,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ios:40,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ostream:38,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/iostream:39,
from /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:2:
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:37:64: note: candidate expects 3 arguments, 1 provided
double epsy = 1.e-10 * std::max({fabs(y1), fabs(y2), fabs(v)});
^
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc: In function ‘bool {anonymous}::Crossing(double, double, double, double, double, double, double, double)’:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:105:75: error: no matching function for call to ‘max(<brace-enclosed initializer list>)’
double epsx = 1.e-10 * std::max({fabs(x1), fabs(x2), fabs(u1), fabs(u2)});
^
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/char_traits.h:39:0,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ios:40,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ostream:38,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/iostream:39,
from /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:2:
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^~~
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:105:75: note: candidate expects 2 arguments, 1 provided
double epsx = 1.e-10 * std::max({fabs(x1), fabs(x2), fabs(u1), fabs(u2)});
^
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/char_traits.h:39:0,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ios:40,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ostream:38,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/iostream:39,
from /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:2:
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:265:5: note: template argument deduction/substitution failed:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:105:75: note: candidate expects 3 arguments, 1 provided
double epsx = 1.e-10 * std::max({fabs(x1), fabs(x2), fabs(u1), fabs(u2)});
^
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:106:75: error: no matching function for call to ‘max(<brace-enclosed initializer list>)’
double epsy = 1.e-10 * std::max({fabs(y1), fabs(y2), fabs(v1), fabs(v2)});
^
In file included from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/char_traits.h:39:0,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ios:40,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/ostream:38,
from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/iostream:39,
from /home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:2:
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^~~
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/include/c++/6.2.0/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed:
/home/kn/simg4/simulationg4/garfieldpp/Source/ViewIsochrons.cc:106:75: note: candidate expects 2 arguments, 1 provided
double epsy = 1.e-10 * std::max({fabs(y1), fabs(y2), fabs(v1), fabs(v2)});