So i'm trying to make a program that reads input from the user, transforms it into a note like this:
--- time
note
Here's the code for it:
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main () {
string notesvar{"/notes"};
string home{std::getenv("HOME")};
string notes{home, notesvar};
time_t now = time(0);
char* dt = ctime(&now);
ofstream myfile;
std::cout << ": ";
string x{};
std::cin >> x;
myfile.open ("placeholder", ios_base::app);
myfile << "---- " << dt;
myfile << x << '\n';
myfile << "\n";
myfile.close();
return 0;
}
This compiles with a lot of notes, but here's the compile log:
notes.cpp: In function ‘int main()’:
notes.cpp:9:32: error: no matching function for call to ‘std::__cxx11::basic_string<char>::basic_string(<brace-enclosed initializer list>)’
9 | string notes{home, notesvar};
| ^
In file included from /usr/include/c++/9.3.0/string:55,
from /usr/include/c++/9.3.0/bits/locale_classes.h:40,
from /usr/include/c++/9.3.0/bits/ios_base.h:41,
from /usr/include/c++/9.3.0/ios:42,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/bits/basic_string.h:650:2: note: candidate: ‘template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&)’
650 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:650:2: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/9.3.0/bits/move.h:55,
from /usr/include/c++/9.3.0/bits/nested_exception.h:40,
from /usr/include/c++/9.3.0/exception:144,
from /usr/include/c++/9.3.0/ios:39,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = std::integral_constant<bool, false>::value; _Tp = void]’:
/usr/include/c++/9.3.0/bits/basic_string.h:117:8: required by substitution of ‘template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using _If_sv = std::enable_if_t<std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value, _Res> [with _Tp = std::__cxx11::basic_string<char>; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
/usr/include/c++/9.3.0/bits/basic_string.h:648:30: required from here
/usr/include/c++/9.3.0/type_traits:2384:11: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
2384 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
In file included from /usr/include/c++/9.3.0/string:55,
from /usr/include/c++/9.3.0/bits/locale_classes.h:40,
from /usr/include/c++/9.3.0/bits/ios_base.h:41,
from /usr/include/c++/9.3.0/ios:42,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/bits/basic_string.h:639:2: note: candidate: ‘template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&)’
639 | basic_string(const _Tp& __t, size_type __pos, size_type __n,
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:639:2: note: template argument deduction/substitution failed:
notes.cpp:9:32: note: candidate expects 4 arguments, 2 provided
9 | string notes{home, notesvar};
| ^
In file included from /usr/include/c++/9.3.0/string:55,
from /usr/include/c++/9.3.0/bits/locale_classes.h:40,
from /usr/include/c++/9.3.0/bits/ios_base.h:41,
from /usr/include/c++/9.3.0/ios:42,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/bits/basic_string.h:625:9: note: candidate: ‘template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&)’
625 | basic_string(_InputIterator __beg, _InputIterator __end,
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:625:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/9.3.0/bits/stl_algobase.h:65,
from /usr/include/c++/9.3.0/bits/char_traits.h:39,
from /usr/include/c++/9.3.0/ios:40,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/bits/stl_iterator_base_types.h: In substitution of ‘template<class _InIter> using _RequireInputIter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<_Iterator>::iterator_category, std::input_iterator_tag>::value>::type [with _InIter = std::__cxx11::basic_string<char>]’:
/usr/include/c++/9.3.0/bits/basic_string.h:621:9: required from here
/usr/include/c++/9.3.0/bits/stl_iterator_base_types.h:232:11: error: no type named ‘iterator_category’ in ‘struct std::iterator_traits<std::__cxx11::basic_string<char> >’
232 | using _RequireInputIter = typename
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9.3.0/string:55,
from /usr/include/c++/9.3.0/bits/locale_classes.h:40,
from /usr/include/c++/9.3.0/bits/ios_base.h:41,
from /usr/include/c++/9.3.0/ios:42,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/bits/basic_string.h:587:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
587 | basic_string(basic_string&& __str, const _Alloc& __a)
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:587:56: note: no known conversion for argument 2 from ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘const std::allocator<char>&’
587 | basic_string(basic_string&& __str, const _Alloc& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/9.3.0/bits/basic_string.h:583:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
583 | basic_string(const basic_string& __str, const _Alloc& __a)
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:583:61: note: no known conversion for argument 2 from ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘const std::allocator<char>&’
583 | basic_string(const basic_string& __str, const _Alloc& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/9.3.0/bits/basic_string.h:579:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
579 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:579:45: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘std::initializer_list<char>’
579 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9.3.0/bits/basic_string.h:552:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
552 | basic_string(basic_string&& __str) noexcept
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:552:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/9.3.0/bits/basic_string.h:540:7: note: candidate: ‘template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT, const _Alloc&)’
540 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:540:7: note: template argument deduction/substitution failed:
notes.cpp:9:18: note: cannot convert ‘home’ (type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}) to type ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’}
9 | string notes{home, notesvar};
| ^~~~
In file included from /usr/include/c++/9.3.0/string:55,
from /usr/include/c++/9.3.0/bits/locale_classes.h:40,
from /usr/include/c++/9.3.0/bits/ios_base.h:41,
from /usr/include/c++/9.3.0/ios:42,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/bits/basic_string.h:525:7: note: candidate: ‘template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&)’
525 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:525:7: note: template argument deduction/substitution failed:
notes.cpp:9:18: note: cannot convert ‘home’ (type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}) to type ‘const char*’
9 | string notes{home, notesvar};
| ^~~~
In file included from /usr/include/c++/9.3.0/string:55,
from /usr/include/c++/9.3.0/bits/locale_classes.h:40,
from /usr/include/c++/9.3.0/bits/ios_base.h:41,
from /usr/include/c++/9.3.0/ios:42,
from /usr/include/c++/9.3.0/ostream:38,
from /usr/include/c++/9.3.0/iostream:39,
from notes.cpp:1:
/usr/include/c++/9.3.0/bits/basic_string.h:510:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
510 | basic_string(const _CharT* __s, size_type __n,
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:510:34: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘const char*’
510 | basic_string(const _CharT* __s, size_type __n,
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/9.3.0/bits/basic_string.h:492:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
492 | basic_string(const basic_string& __str, size_type __pos,
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:492:7: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/9.3.0/bits/basic_string.h:476:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
476 | basic_string(const basic_string& __str, size_type __pos,
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:476:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/9.3.0/bits/basic_string.h:461:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
461 | basic_string(const basic_string& __str, size_type __pos,
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:461:57: note: no known conversion for argument 2 from ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’}
461 | basic_string(const basic_string& __str, size_type __pos,
| ~~~~~~~~~~^~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:448:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
448 | basic_string(const basic_string& __str)
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:448:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/9.3.0/bits/basic_string.h:440:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
440 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:440:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/9.3.0/bits/basic_string.h:431:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
431 | basic_string()
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:431:7: note: candidate expects 0 arguments, 2 provided
/usr/include/c++/9.3.0/bits/basic_string.h:145:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::__sv_wrapper, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
145 | basic_string(__sv_wrapper __svw, const _Alloc& __a)
| ^~~~~~~~~~~~
/usr/include/c++/9.3.0/bits/basic_string.h:145:33: note: no known conversion for argument 1 from ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘std::__cxx11::basic_string<char>::__svT_wrapper’
145 | basic_string(__sv_wrapper __svw, const _Alloc& __a)
|
It was compiled using g++ -std=c++17 -o notes notes.cpp. Sorry if this is a stupid question. I'm just beginning with C++.
What confuses me is the error on... line 232?! Thanks in advance for helping!
string notes{home, notesvar};
There is no std::string(std::string, std::string) constructor. To construct another string as concatenation of two other strings, just operator + add them.
string notes = home + notesvar;
Related
For my research study, I need to fit some Supernovae Light Curves (LC). For this purpose, there are some templates available to fit the SNe lightcurves. One such LC template fitter is the snfit-2.4.2 . While building 1it from the source I'm getting some errors, which is described below:
salt2extinction.cc:132:10: error: no match for 'operator<<' (operand
types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'})
132 | cerr << message << endl;
| ~~~~ ^~ ~~~~~~~
| | |
| | std::stringstream {aka std::__cxx11::basic_stringstream<char>}
| std::ostream {aka std::basic_ostream<char>}
salt2extinction.cc:132:10: note: candidate: 'operator<<(int, int)' <built-in>
132 | cerr << message << endl;
| ~~~~~^~~~~~~~~~
salt2extinction.cc:132:10: note: no known conversion for argument 2 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'int'
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:108:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
108 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/9/ostream:108:36: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
108 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/ostream:117:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]'
117 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/9/ostream:117:32: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
117 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/9/ostream:127:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
127 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/9/ostream:127:30: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'std::ios_base& (*)(std::ios_base&)'
127 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/9/ostream:166:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
166 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:166:23: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'long int'
166 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/9/ostream:170:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
170 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:170:32: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'long unsigned int'
170 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
174 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:174:23: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'bool'
174 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/9/ostream:702,
from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/bits/ostream.tcc:91:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
91 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/ostream.tcc:92:22: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'short int'
92 | operator<<(short __n)
| ~~~~~~^~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:181:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
181 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:181:33: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'short unsigned int'
181 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/9/ostream:702,
from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/bits/ostream.tcc:105:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
105 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/ostream.tcc:106:20: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'int'
106 | operator<<(int __n)
| ~~~~^~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:192:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
192 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:192:31: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'unsigned int'
192 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:201:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
201 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:201:28: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'long long int'
201 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/9/ostream:205:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
205 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:205:37: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'long long unsigned int'
205 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:220:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
220 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/9/ostream:220:25: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'double'
220 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/9/ostream:224:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
224 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/9/ostream:224:24: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'float'
224 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/9/ostream:232:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
232 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/9/ostream:232:30: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'long double'
232 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:245:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]'
245 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/9/ostream:245:30: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'const void*'
245 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
In file included from /usr/include/c++/9/ostream:702,
from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/bits/ostream.tcc:119:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]'
119 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/ostream.tcc:120:34: note: no known conversion for argument 1 from 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} to 'std::basic_ostream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
120 | operator<<(__streambuf_type* __sbin)
| ~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/9/string:55,
from /usr/include/c++/9/bits/locale_classes.h:40,
from /usr/include/c++/9/bits/ios_base.h:41,
from /usr/include/c++/9/ios:42,
from /usr/include/c++/9/ostream:38,
from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/bits/basic_string.h:6416:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
6416 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6416:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/bits/ios_base.h:46,
from /usr/include/c++/9/ios:42,
from /usr/include/c++/9/ostream:38,
from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/system_error:217:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::error_code&)'
217 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/9/system_error:217:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'const std::error_code&'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:506:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT)'
506 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/9/ostream:506:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: deduced conflicting types for parameter '_CharT' ('char' and 'std::__cxx11::basic_stringstream<char>')
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:511:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char)'
511 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/9/ostream:511:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'char'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:517:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char)'
517 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/9/ostream:517:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'char'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:523:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, signed char)'
523 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/9/ostream:523:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'signed char'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:528:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char)'
528 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/9/ostream:528:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'unsigned char'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:548:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const _CharT*)'
548 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/9/ostream:548:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_stringstream<char>'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/ostream:702,
from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/bits/ostream.tcc:321:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*)'
321 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/9/bits/ostream.tcc:321:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'const char*'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:565:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*)'
565 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/9/ostream:565:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'const char*'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:578:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const signed char*)'
578 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/9/ostream:578:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'const signed char*'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:583:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned char*)'
583 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/9/ostream:583:5: note: template argument deduction/substitution failed:
salt2extinction.cc:132:13: note: cannot convert 'message' (type 'std::stringstream' {aka 'std::__cxx11::basic_stringstream<char>'}) to type 'const unsigned char*'
132 | cerr << message << endl;
| ^~~~~~~
In file included from /usr/include/c++/9/iostream:39,
from salt2extinction.cc:1:
/usr/include/c++/9/ostream:691:5: note: candidate: 'template<class _Ostream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_ostream<_Ostream>, std::__is_insertable<typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type, const _Tp&, void> >::value, typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type>::type std::operator<<(_Ostream&&, const _Tp&)'
691 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/9/ostream:691:5: note: template argument deduction/substitution failed:
/usr/include/c++/9/ostream: In substitution of 'template<class _Ostream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_ostream<_Ostream>, std::__is_insertable<typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type, const _Tp&, void> >::value, typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type>::type std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_ostream<char>&; _Tp = std::__cxx11::basic_stringstream<char>]':
salt2extinction.cc:132:13: required from here
/usr/include/c++/9/ostream:691:5: error: no type named 'type' in 'struct std::enable_if<false, std::basic_ostream<char>&>'
make[2]: *** [Makefile:619: salt2extinction.lo] Error 1
make[2]: Leaving directory '/usr/local/salt/build/snfit-2.4.2/src'
make[1]: *** [Makefile:305: all-recursive] Error 1
make[1]: Leaving directory '/usr/local/salt/build/snfit-2.4.2'
make: *** [Makefile:236: all] Error 2
The source file to build snfit-2.4.2 canbe downloaded from:
http://supernovae.in2p3.fr/salt/lib/exe/fetch.php?media=jla-installation.sh
I have tried to build this on three separate machines:
my own machine with :
AMD A8 7650 processor
Zorin 20.04 OS
My workstation #1 with:
Intel Xeon Octacore
Ubuntu 18.04.2
My workstation #2 with:
Intel Xeon Octacore
Ubuntu 20.04.2
In all these machines I'm getting the same problem.
I don't have much experience in C++.
Therefore, I'm not quite able to make sense of the issue to begin with.
The simple fix is change the code to:
stringstream message;
message << "ERROR Salt2ExtinctionLaw::Read unknown version " << version;
cerr << message.str() << endl;
I'm currently having some trouble on upgrading to latest GTest from Conan Center (at the time of writing this is GTest cci.20210126). My Code worked fine with old GTest V1.10.
In our project we use the << Operator to convert Data to a string stream and vice versa
class Foo;
/* overloading of << operator */
std::ostream& operator<<(std::ostream& lhs, Foo const& rhs);
/* overloading of >> operator */
std::istream& operator>>(std::istream& lhs, Foo& rhs);
class Foo
{
public:
// overloading of << operator
friend std::ostream& ::operator<<(std::ostream& lhs, Foo const& rhs);
// overloading of >> operator
friend std::istream& ::operator>>(std::istream& lhs, Foo& rhs);
}
I get lots of
/usr/include/c++/9/ostream:108:36: note: no known conversion for argument 1 from ‘const Foo’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)’ {aka ‘std::basic_ostream<char>& (*)(std::basic_ostream<char>&)’}
108 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/ostream:117:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]’
117 | operator<<(__ios_type& (*__pf)(__ios_type&))
=>this sound like modern GTest does not find the << operator overload
What is the modern way to overload the operator? I personally am not so keen of using the friends keyword extensively
Could you help me out here?
Edit:
As requested the full (very long) error message. I'm sorry I don't know where to clip it
[13/275] Building CXX object x/x/core/datatypes/tests/CMakeFiles/UnitTest_ProbeValue.dir/UnitTest_ProbeValue.cpp.o
FAILED: x/x/core/datatypes/tests/CMakeFiles/UnitTest_ProbeValue.dir/UnitTest_ProbeValue.cpp.o
/usr/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DTIXML_USE_STL -DprojCOVERAGE_TEST=0 -I/home/user/.vs/build/y/_t300_linux_ninja/x/x -I/home/user/.vs/build/y/_t300_linux_ninja/x -I/home/user/.vs/y/x -isystem /home/user/Qt/5.15.1/gcc_64/include -isystem /home/user/Qt/5.15.1/gcc_64/include/QtCore -isystem /home/user/Qt/5.15.1/gcc_64/./mkspecs/linux-g++ -isystem /home/user/Qt/5.15.1/gcc_64/include/QtGui -isystem /home/user/.conan/data/tinyxml/2.6.2/_/_/package/344b57466ca5410afe53b08a52efb92ca37883f2/include -isystem /home/user/.conan/data/jsoncpp/1.9.4/_/_/package/a0d04ca949f5f2ad68af2af705b4e0f9a95967a0/include -isystem /home/user/.conan/data/zlib/1.2.11/_/_/package/23b828d52c0630e6b0b96d2945419feb7843c4f8/include -isystem /home/user/include -Wall -Wextra -Wno-unused-parameter -Wno-error=deprecated-declarations -Wno-error=strict-overflow -Wno-unknown-pragmas -Wno-conversion-null -Wno-error=comment -Wall -Wextra -Wno-unused-parameter -Wno-error=deprecated-declarations -Wno-error=strict-overflow -Wno-unknown-pragmas -Wno-conversion-null -Wno-error=comment -gdwarf-2 -fpermissive -fdiagnostics-generate-patch -g -fPIC -std=c++2a -MD -MT x/x/core/datatypes/tests/CMakeFiles/UnitTest_ProbeValue.dir/UnitTest_ProbeValue.cpp.o -MF x/x/core/datatypes/tests/CMakeFiles/UnitTest_ProbeValue.dir/UnitTest_ProbeValue.cpp.o.d -o x/x/core/datatypes/tests/CMakeFiles/UnitTest_ProbeValue.dir/UnitTest_ProbeValue.cpp.o -c /home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp
In file included from /home/user/include/gtest/gtest-matchers.h:48,
from /home/user/include/gtest/internal/gtest-death-test-internal.h:39,
from /home/user/include/gtest/gtest-death-test.h:41,
from /home/user/include/gtest/gtest.h:64,
from /home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp:3:
/home/user/include/gtest/gtest-printers.h: In instantiation of ‘struct testing::internal::FindFirstPrinter<__gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >, void, testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter, testing::internal::ProtobufPrinter, testing::internal::ConvertibleToIntegerPrinter, testing::internal::ConvertibleToStringViewPrinter, testing::internal::RawBytesPrinter, testing::internal::FallbackPrinter>’:
/home/user/include/gtest/gtest-printers.h:287:8: required from ‘struct testing::internal::FindFirstPrinter<__gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >, void, testing::internal::ContainerPrinter, testing::internal::FunctionPointerPrinter, testing::internal::PointerPrinter, testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter, testing::internal::ProtobufPrinter, testing::internal::ConvertibleToIntegerPrinter, testing::internal::ConvertibleToStringViewPrinter, testing::internal::RawBytesPrinter, testing::internal::FallbackPrinter>’
/home/user/include/gtest/gtest-printers.h:307:9: required from ‘void testing::internal::PrintWithFallback(const T&, std::ostream*) [with T = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; std::ostream = std::basic_ostream<char>]’
/home/user/include/gtest/gtest-printers.h:441:30: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/user/include/gtest/gtest-printers.h:902:30: required from ‘void testing::internal::UniversalPrint(const T&, std::ostream*) [with T = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; std::ostream = std::basic_ostream<char>]’
/home/user/include/gtest/gtest-printers.h:830:19: required from ‘static void testing::internal::UniversalTersePrinter<T>::Print(const T&, std::ostream*) [with T = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; std::ostream = std::basic_ostream<char>]’
/home/user/include/gtest/gtest-printers.h:940:44: required from ‘std::string testing::PrintToString(const T&) [with T = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; std::string = std::__cxx11::basic_string<char>]’
/home/user/include/gtest/gtest-printers.h:334:36: required from ‘static std::string testing::internal::FormatForComparison<ToPrint, OtherOperand>::Format(const ToPrint&) [with ToPrint = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; OtherOperand = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; std::string = std::__cxx11::basic_string<char>]’
/home/user/include/gtest/gtest-printers.h:415:45: required from ‘std::string testing::internal::FormatForComparisonFailureMessage(const T1&, const T2&) [with T1 = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; T2 = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; std::string = std::__cxx11::basic_string<char>]’
/home/user/include/gtest/gtest.h:1600:63: required from ‘testing::AssertionResult testing::internal::CmpHelperOpFailure(const char*, const char*, const T1&, const T2&, const char*) [with T1 = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; T2 = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >]’
/home/user/include/gtest/gtest.h:1624:1: required from ‘testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >; T2 = __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >]’
/home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp:32:3: required from here
/home/user/include/gtest/gtest-printers.h:291:36: error: no matching function for call to ‘testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >&, std::nullptr_t)’
291 | T, decltype(Printer::PrintValue(std::declval<const T&>(), nullptr)),
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/include/gtest/gtest-printers.h:212:15: note: candidate: ‘template<class T, class, class> static void testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const T&, std::ostream*)’
212 | static void PrintValue(const T& value, ::std::ostream* os) {
| ^~~~~~~~~~
/home/user/include/gtest/gtest-printers.h:212:15: note: template argument deduction/substitution failed:
/home/user/include/gtest/gtest-printers.h:211:33: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’)
210 | typename = decltype(std::declval<std::ostream&>()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211 | << std::declval<const T&>())>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9/istream:39,
from /usr/include/c++/9/sstream:38,
...
/usr/include/c++/9/ostream:108:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
108 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/9/ostream:108:36: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)’ {aka ‘std::basic_ostream<char>& (*)(std::basic_ostream<char>&)’}
108 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/ostream:117:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]’
117 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/9/ostream:117:32: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’}
117 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/9/ostream:127:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
127 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/9/ostream:127:30: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘std::ios_base& (*)(std::ios_base&)’
127 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/9/ostream:166:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
166 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:166:23: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘long int’
166 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/9/ostream:170:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
170 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:170:32: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘long unsigned int’
170 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:174:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
174 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:174:23: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘bool’
174 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/9/ostream:702,
from /usr/include/c++/9/istream:39,
from /usr/include/c++/9/sstream:38,
...
/usr/include/c++/9/bits/ostream.tcc:91:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]’
91 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/ostream.tcc:92:22: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘short int’
92 | operator<<(short __n)
| ~~~~~~^~~
In file included from /usr/include/c++/9/istream:39,
from /usr/include/c++/9/sstream:38,
...
/usr/include/c++/9/ostream:181:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
181 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:181:33: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘short unsigned int’
181 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/9/ostream:702,
from /usr/include/c++/9/istream:39,
from /usr/include/c++/9/sstream:38,
...
/usr/include/c++/9/bits/ostream.tcc:105:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]’
105 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/ostream.tcc:106:20: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘int’
106 | operator<<(int __n)
| ~~~~^~~
In file included from /usr/include/c++/9/istream:39,
from /usr/include/c++/9/sstream:38,
...
/usr/include/c++/9/ostream:192:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
192 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:192:31: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘unsigned int’
192 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:201:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
201 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:201:28: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘long long int’
201 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/9/ostream:205:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
205 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/9/ostream:205:37: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘long long unsigned int’
205 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:220:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
220 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/9/ostream:220:25: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘double’
220 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/9/ostream:224:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
224 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/9/ostream:224:24: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘float’
224 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/9/ostream:232:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
232 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/9/ostream:232:30: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘long double’
232 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:245:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
245 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/9/ostream:245:30: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘const void*’
245 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/9/ostream:250:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]’
250 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/9/ostream:250:18: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘std::nullptr_t’
250 | operator<<(nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/9/ostream:702,
from /usr/include/c++/9/istream:39,
from /usr/include/c++/9/sstream:38,
from /home/user/.vs/y/x/x/core/exception/TException.h:29,
from /home/user/.vs/y/x/x/core/datatypes/TypeObject.h:5,
from /home/user/.vs/y/x/x/core/datatypes/MarkedFloat.h:6,
from /home/user/.vs/y/x/x/core/datatypes/ProbeValue.h:6,
from /home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp:1:
/usr/include/c++/9/bits/ostream.tcc:119:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]’
119 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/ostream.tcc:120:34: note: no known conversion for argument 1 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘std::basic_ostream<char>::__streambuf_type*’ {aka ‘std::basic_streambuf<char>*’}
120 | operator<<(__streambuf_type* __sbin)
| ~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /home/user/include/gtest/internal/gtest-internal.h:65,
from /home/user/include/gtest/gtest.h:62,
from /home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp:3:
/home/user/include/gtest/gtest-message.h:199:22: note: candidate: ‘std::ostream& testing::operator<<(std::ostream&, const testing::Message&)’
199 | inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
| ^~~~~~~~
/home/user/include/gtest/gtest-message.h:199:67: note: no known conversion for argument 2 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘const testing::Message&’
199 | inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
| ~~~~~~~~~~~~~~~^~
In file included from /home/user/include/gtest/internal/gtest-death-test-internal.h:39,
from /home/user/include/gtest/gtest-death-test.h:41,
from /home/user/include/gtest/gtest.h:64,
from /home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp:3:
/home/user/include/gtest/gtest-matchers.h:618:15: note: candidate: ‘template<class T> std::ostream& testing::operator<<(std::ostream&, const testing::Matcher<T>&)’
618 | std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
| ^~~~~~~~
/home/user/include/gtest/gtest-matchers.h:618:15: note: template argument deduction/substitution failed:
In file included from /home/user/include/gtest/gtest-matchers.h:48,
from /home/user/include/gtest/internal/gtest-death-test-internal.h:39,
from /home/user/include/gtest/gtest-death-test.h:41,
from /home/user/include/gtest/gtest.h:64,
from /home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp:3:
/home/user/include/gtest/gtest-printers.h:211:33: note: ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ is not derived from ‘const testing::Matcher<T>’
210 | typename = decltype(std::declval<std::ostream&>()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211 | << std::declval<const T&>())>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/user/include/gtest/internal/gtest-param-util.h:52,
from /home/user/include/gtest/gtest-param-test.h:179,
from /home/user/include/gtest/gtest.h:67,
from /home/user/.vs/y/x/x/core/datatypes/tests/UnitTest_ProbeValue.cpp:3:
/home/user/include/gtest/gtest-test-part.h:123:15: note: candidate: ‘std::ostream& testing::operator<<(std::ostream&, const testing::TestPartResult&)’
123 | std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
| ^~~~~~~~
/home/user/include/gtest/gtest-test-part.h:123:66: note: no known conversion for argument 2 from ‘const __gnu_cxx::__normal_iterator<z::ProbeValue*, std::vector<z::ProbeValue> >’ to ‘const testing::TestPartResult&’
123 | std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
ninja: build stopped: subcommand failed.
Edit 2:
After a very good spot from Marek, here are the appropriote code lines
TEST(ProbeValueTest, stl_find)
{
auto testValues{std::vector<ProbeValue>{
ProbeValue(0.0f, 2U, 0U)
}};
auto itr{std::find(testValues.begin(), testValues.end(), ProbeValue(0.0f, 2U, 0U))};
ASSERT_NE( testValues.end(), itr);
}
Well, i have this code:
#include <iostream>
#include "Stack.h"
#include <string>
using namespace std;
int main(int argc, char* argv[]){
Stack<string> p(100);
p.push("python");
p.push("haskell");
p.push("C++");
//p.desempilhar();
if(p.isEmpty())
cout << "Pilha vazia!\n";
else
cout << "Pilha NAO vazia!\n";
if(!p.isEmpty())
cout << "Topo: " << p.peek() << endl;
else
cout << "A pilha esta vazia!!\n";
return 0;
}
and this .h code in folder /home/matheus/Codes/C++/EstruturaDeDados:
#ifndef __STACK_H_
#define __STACK_H_
#include <iostream>
using namespace std;
/*
Declarando a criação de um template para classe Stack.
Stack aqui é um template, não uma classe propriamente dita.
Ao ser declarada da maneira correta se torna uma classe de fato.
*/
template <class T>
class Stack {
private:
int top;
T* a;
int MAX;
public:
Stack(int MAX);
bool push(T x); //Adiciona um T a stack.
bool pop(); //Remove o T mais acima da stack.
T peek(); //Retorna o T mais acima da stack.
bool isEmpty();
};
//Declarando uso de um template. template <class T>
template <class T>
//"Stack<T>" é uma classe baseada no "template <class T>".
Stack<T>::Stack(int MAX){
a = new T(MAX);
top = -1;
this->MAX = MAX;
}
//Declarando uso de um template. template <class T>
template <class T>
//"Stack<T>" é uma classe baseada no "template <class T>".
bool Stack<T>::push(T x) {
if (top >= (MAX - 1)) {
cout << "Stack Overflow" << endl;
return false;
} else {
a[++top] = x;
cout << x << " pushed into stack" << endl;
return true;
}
}
//Declarando uso de um template.
template <class T>
//"Stack<T>" é uma classe baseada no "template <class T>".
bool Stack<T>::pop() {
if (top < 0) {
cout << "Stack Underflow" << endl;
return false;
}
else {
cout << a[top--] << " Popped from stack" << endl;
return true;
}
}
//Declarando uso de um template.
template <class T>
//"Stack<T>" é uma classe baseada no "template <class T>".
T Stack<T>::peek() {
if (top < 0) {
cout << "Stack is Empty" << endl;
return NULL;
} else {
return a[top];
}
}
//Declarando uso de um template.
template <class T>
//"Stack<T>" é uma <<classe baseada no "template <class T>".
bool Stack<T>::isEmpty() {
return (top < 0);
}
#endif
When i try to compile, i receive this error i cannot even understand what it is:
In file included from 21Templates.cpp:2:
/home/matheus/Codes/C++/EstruturaDeDados/Stack.h: In instantiation of ‘Stack<T>::Stack(int) [with T = std::__cxx11::basic_string<char>]’:
21Templates.cpp:8:21: required from here
/home/matheus/Codes/C++/EstruturaDeDados/Stack.h:32:9: error: no matching function for call to ‘std::__cxx11::basic_string<char>::basic_string(int&)’
a = new T(MAX);
^~~~~~~~~~
In file included from /usr/include/c++/8/string:52,
from /usr/include/c++/8/bits/locale_classes.h:40,
from /usr/include/c++/8/bits/ios_base.h:41,
from /usr/include/c++/8/ios:42,
from /usr/include/c++/8/ostream:38,
from /usr/include/c++/8/iostream:39,
from 21Templates.cpp:1:
/usr/include/c++/8/bits/basic_string.h:614:9: note: candidate: ‘template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&)’
basic_string(_InputIterator __beg, _InputIterator __end,
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:614:9: note: template argument deduction/substitution failed:
In file included from 21Templates.cpp:2:
/home/matheus/Codes/C++/EstruturaDeDados/Stack.h:32:9: note: candidate expects 3 arguments, 1 provided
a = new T(MAX);
^~~~~~~~~~
In file included from /usr/include/c++/8/string:52,
from /usr/include/c++/8/bits/locale_classes.h:40,
from /usr/include/c++/8/bits/ios_base.h:41,
from /usr/include/c++/8/ios:42,
from /usr/include/c++/8/ostream:38,
from /usr/include/c++/8/iostream:39,
from 21Templates.cpp:1:
/usr/include/c++/8/bits/basic_string.h:576:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
basic_string(basic_string&& __str, const _Alloc& __a)
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:576:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/8/bits/basic_string.h:572:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
basic_string(const basic_string& __str, const _Alloc& __a)
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:572:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/8/bits/basic_string.h:568:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:568:7: note: no known conversion for argument 1 from ‘int’ to ‘std::initializer_list<char’
/usr/include/c++/8/bits/basic_string.h:541:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
basic_string(basic_string&& __str) noexcept
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:541:7: note: no known conversion for argument 1 from ‘int’ to ‘std::__cxx11::basic_string<char>&&’
/usr/include/c++/8/bits/basic_string.h:529:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:529:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/8/bits/basic_string.h:514:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ <near match>
basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:514:7: note: conversion of argument 1 would be ill-formed:
In file included from 21Templates.cpp:2:
/home/matheus/Codes/C++/EstruturaDeDados/Stack.h:32:9: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
a = new T(MAX);
^~~~~~~~~~
In file included from /usr/include/c++/8/string:52,
from /usr/include/c++/8/bits/locale_classes.h:40,
from /usr/include/c++/8/bits/ios_base.h:41,
from /usr/include/c++/8/ios:42,
from /usr/include/c++/8/ostream:38,
from /usr/include/c++/8/iostream:39,
from 21Templates.cpp:1:
/usr/include/c++/8/bits/basic_string.h:499:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int’
basic_string(const _CharT* __s, size_type __n,
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:499:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/8/bits/basic_string.h:481:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
basic_string(const basic_string& __str, size_type __pos,
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:481:7: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/8/bits/basic_string.h:465:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
basic_string(const basic_string& __str, size_type __pos,
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:465:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/8/bits/basic_string.h:450:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
basic_string(const basic_string& __str, size_type __pos,
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:450:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/8/bits/basic_string.h:437:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
basic_string(const basic_string& __str)
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:437:7: note: no known conversion for argument 1 from ‘int’ to ‘const std::__cxx11::basic_string<char>&’
/usr/include/c++/8/bits/basic_string.h:429:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:429:7: note: no known conversion for argument 1 from ‘int’ to ‘const std::allocator<char>’
/usr/include/c++/8/bits/basic_string.h:420:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
basic_string()
^~~~~~~~~~~~
/usr/include/c++/8/bits/basic_string.h:420:7: note: candidate expects 0 arguments, 1 provided
The .h is a template for a stack, im trying to code all of this with: g++ -I /home/matheus/Codes/C++/EstruturaDeDados/ -o 21Templates 21Templates.cpp, but im receiving over and over again this error.
How i solve this? And what exactly is that error?
This statement
a = new T(MAX);
tries to create an object of the type std::string from the integer value MAX. However the class std::string has no such a constructor.
It seems you mean
a = new T[MAX];
that is you want to create an array of objects of the type std::string.
This function
T Stack<T>::peek() {
if (top < 0) {
cout << "Stack is Empty" << endl;
return NULL;
} else {
return a[top];
}
}
is also wrong because creating an object of the type std::string from a null pointer results in undefined behavior. You should throw an exception for example std::out_of_range.
Pay attention to that the class has no destructor.
Instead of the dynamically allocated array you could use the class std::vector<std::string>.
If you are trying to make an array, change this line
a = new T(MAX);
to this
a = new T[MAX];
and remember to delete it later or you'll leak that memory
Stack::~Stack()
{
delete[] a;
}
starting to learn classes in c++ and i came across a simple board game... but i got this insane amount of error that i cant solve.
if i shouldn't post this kind of question here, please advise me.
Board.h:
#include<vector>
using namespace std;
class Board{
int largura;
int altura;
public:
Board(int x,int y) : largura(x), altura(y) {}
vector<vector<int> > mat();
void printa();
};
Board.cpp:
#include "Board.h"
#include <vector>
#include <iostream>
using namespace std;
vector<vector<int> > Board::mat() {
vector<vector<int> > v(altura, vector<int>(largura,1));
return v;
}
void Board::printa() {
auto matriz = mat();
vector<int> vec(largura,0);
for(;;) {
for (auto i:vec) {
for (auto j:vec) {
cout << matriz[i,j];
}
cout << "\n";
}
}
}
main.cpp:
#include<iostream>
#include "Board.h"
#include <vector>
using namespace std;
int main(){
Board tela(5, 5);
tela.mat();
tela.printa();
return 0;
}
the error:
[Rafael#localhost untitled]$ g++ -std=c++17 main.cpp Board.cpp -o board
Board.cpp: In member function ‘void Board::printa()’:
Board.cpp:22:22: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’)
cout << matriz[i,j];
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:108:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(__ostream_type& (*__pf)(__ostream_type&))
^~~~~~~~
/usr/include/c++/6.3.1/ostream:108:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&) {aka std::basic_ostream<char>& (*)(std::basic_ostream<char>&)}’
/usr/include/c++/6.3.1/ostream:117:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]
operator<<(__ios_type& (*__pf)(__ios_type&))
^~~~~~~~
/usr/include/c++/6.3.1/ostream:117:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}’
/usr/include/c++/6.3.1/ostream:127:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(ios_base& (*__pf) (ios_base&))
^~~~~~~~
/usr/include/c++/6.3.1/ostream:127:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘std::ios_base& (*)(std::ios_base&)’
/usr/include/c++/6.3.1/ostream:166:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(long __n)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:166:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘long int’
/usr/include/c++/6.3.1/ostream:170:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(unsigned long __n)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:170:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘long unsigned int’
/usr/include/c++/6.3.1/ostream:174:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(bool __n)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:174:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘bool’
In file included from /usr/include/c++/6.3.1/ostream:638:0,
from /usr/include/c++/6.3.1/iostream:39,
from Board.cpp:7:
/usr/include/c++/6.3.1/bits/ostream.tcc:91:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]
basic_ostream<_CharT, _Traits>::
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6.3.1/bits/ostream.tcc:91:5: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘short int’
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:181:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(unsigned short __n)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:181:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘short unsigned int’
In file included from /usr/include/c++/6.3.1/ostream:638:0,
from /usr/include/c++/6.3.1/iostream:39,
from Board.cpp:7:
/usr/include/c++/6.3.1/bits/ostream.tcc:105:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]
basic_ostream<_CharT, _Traits>::
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6.3.1/bits/ostream.tcc:105:5: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘int’
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:192:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(unsigned int __n)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:192:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘unsigned int’
/usr/include/c++/6.3.1/ostream:201:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(long long __n)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:201:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘long long int’
/usr/include/c++/6.3.1/ostream:205:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(unsigned long long __n)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:205:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘long long unsigned int’
/usr/include/c++/6.3.1/ostream:220:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(double __f)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:220:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘double’
/usr/include/c++/6.3.1/ostream:224:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(float __f)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:224:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘float’
/usr/include/c++/6.3.1/ostream:232:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(long double __f)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:232:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘long double’
/usr/include/c++/6.3.1/ostream:245:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
operator<<(const void* __p)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:245:7: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘const void*’
In file included from /usr/include/c++/6.3.1/ostream:638:0,
from /usr/include/c++/6.3.1/iostream:39,
from Board.cpp:7:
/usr/include/c++/6.3.1/bits/ostream.tcc:119:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]
basic_ostream<_CharT, _Traits>::
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6.3.1/bits/ostream.tcc:119:5: note: no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ to ‘std::basic_ostream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}’
In file included from /usr/include/c++/6.3.1/string:52:0,
from /usr/include/c++/6.3.1/bits/locale_classes.h:40,
from /usr/include/c++/6.3.1/bits/ios_base.h:41,
from /usr/include/c++/6.3.1/ios:42,
from /usr/include/c++/6.3.1/ostream:38,
from /usr/include/c++/6.3.1/iostream:39,
from Board.cpp:7:
/usr/include/c++/6.3.1/bits/basic_string.h:5325:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
operator<<(basic_ostream<_CharT, _Traits>& __os,
^~~~~~~~
/usr/include/c++/6.3.1/bits/basic_string.h:5325:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/bits/ios_base.h:46:0,
from /usr/include/c++/6.3.1/ios:42,
from /usr/include/c++/6.3.1/ostream:38,
from /usr/include/c++/6.3.1/iostream:39,
from Board.cpp:7:
/usr/include/c++/6.3.1/system_error:209:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::error_code&)
operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
^~~~~~~~
/usr/include/c++/6.3.1/system_error:209:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘const std::error_code&’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:497:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT)
operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:497:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘std::vector<int>’)
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:502:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char)
operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:502:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘char’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:508:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char)
operator<<(basic_ostream<char, _Traits>& __out, char __c)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:508:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘char’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:514:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, signed char)
operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:514:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘signed char’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:519:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char)
operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:519:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘unsigned char’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:539:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const _CharT*)
operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:539:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: mismatched types ‘const _CharT*’ and ‘std::vector<int>’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/ostream:638:0,
from /usr/include/c++/6.3.1/iostream:39,
from Board.cpp:7:
/usr/include/c++/6.3.1/bits/ostream.tcc:321:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*)
operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
^~~~~~~~
/usr/include/c++/6.3.1/bits/ostream.tcc:321:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘const char*’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:556:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*)
operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:556:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘const char*’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:569:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const signed char*)
operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:569:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘const signed char*’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:574:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned char*)
operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:574:5: note: template argument deduction/substitution failed:
Board.cpp:22:35: note: cannot convert ‘matriz.std::vector<_Tp, _Alloc>::operator[]<std::vector<int>, std::allocator<std::vector<int> > >(((void)0, ((std::vector<std::vector<int> >::size_type)j)))’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> > >::value_type {aka std::vector<int>}’) to type ‘const unsigned char*’
cout << matriz[i,j];
^
In file included from /usr/include/c++/6.3.1/iostream:39:0,
from Board.cpp:7:
/usr/include/c++/6.3.1/ostream:628:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = std::vector<int>] <near match>
operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
^~~~~~~~
/usr/include/c++/6.3.1/ostream:628:5: note: conversion of argument 1 would be ill-formed:
Board.cpp:22:35: error: cannot bind ‘std::ostream {aka std::basic_ostream<char>}’ lvalue to ‘std::basic_ostream<char>&&’
cout << matriz[i,j];
[i,j] is a trap. It's the same thing as [j]. What you want is matriz[i][j];, not matriz[i,j].
(You should also avoid using directives in header files, but that's purely cosmetic. Your problem is the [i,j] part.)
I want to search for a regular expression and print it with a color. I used boost::sregex_token_iterator to do this. this is my code
boost::regex re("ab.");
string s="";
string buf;
string infile("retest.txt");
//string color="green";
ifstream in(infile.c_str());
int lcount=0;
while (getline(in,buf))
{
boost::sregex_token_iterator p(buf.begin(), buf.end(), re, 0);
boost::sregex_token_iterator end;
lcount++;
cout <<"line : "<<lcount<<endl;
for (;p != end;++p)
{
string m(p->first, p->second);
cout<< m <<endl;
//cout <<*(p->first)<<endl;
//cout <<*(p->second)<<endl;
//unsigned int pos = buf.find(m);
buf = buf.insert(p->first,"\e[0;32m");
buf = buf.insert(p->second+m.length()+7,"\e[0m");
}
cout<<"\n";
s.append(buf);
s.append("\n");
}
in.close();
cout <<"s is: "<<s<<endl;
return 0;
}
but I get this error :
In file included from /usr/include/boost/config.hpp:35:0,
from /usr/include/boost/regex/config.hpp:53,
from /usr/include/boost/regex.hpp:28,
from main3.cc:3:
/usr/include/boost/config/compiler/gcc.hpp:92:7: warning: #warning "Unknown compiler version - please run the configure tests and report the results" [-Wcpp]
main3.cc: In function âint main(int, char**)â:
main3.cc:36:40: error: no matching function for call to âstd::basic_string::insert(const __gnu_cxx::__normal_iterator >&, const char [8])â
main3.cc:36:40: note: candidates are:
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:54:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1182:7: note: void std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1182:7: note: candidate expects 3 arguments, 2 provided
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1199:9: note: template void std::basic_string::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1199:9: note: template argument deduction/substitution failed:
main3.cc:36:40: note: cannot convert âp.boost::regex_token_iterator::operator-><__gnu_cxx::__normal_iterator >, char, boost::regex_traits, std::allocator >()->boost::sub_match<__gnu_cxx::__normal_iterator > >::.std::pair<__gnu_cxx::__normal_iterator >, __gnu_cxx::__normal_iterator > >::firstâ (type âconst __gnu_cxx::__normal_iterator >â) to type âstd::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}â
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:54:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1230:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1230:7: note: no known conversion for argument 1 from âconst __gnu_cxx::__normal_iterator >â to âstd::basic_string::size_type {aka unsigned int}â
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1252:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1252:7: note: candidate expects 4 arguments, 2 provided
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:55:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.tcc:361:6: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.tcc:361:6: note: candidate expects 3 arguments, 2 provided
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:54:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1293:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1293:7: note: no known conversion for argument 1 from âconst __gnu_cxx::__normal_iterator >â to âstd::basic_string::size_type {aka unsigned int}â
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1316:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1316:7: note: candidate expects 3 arguments, 2 provided
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1334:7: note: std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1334:7: note: no known conversion for argument 1 from âconst __gnu_cxx::__normal_iterator >â to âstd::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}â
main3.cc:37:51: error: no matching function for call to âstd::basic_string::insert(__gnu_cxx::__normal_iterator >, const char [5])â
main3.cc:37:51: note: candidates are:
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:54:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1182:7: note: void std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1182:7: note: candidate expects 3 arguments, 2 provided
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1199:9: note: template void std::basic_string::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1199:9: note: template argument deduction/substitution failed:
main3.cc:37:51: note: cannot convert âp.boost::regex_token_iterator::operator-><__gnu_cxx::__normal_iterator >, char, boost::regex_traits, std::allocator >()->boost::sub_match<__gnu_cxx::__normal_iterator > >::.std::pair<__gnu_cxx::__normal_iterator >, __gnu_cxx::__normal_iterator > >::second.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+ >((* &((__gnu_cxx::__normal_iterator >::difference_type)m.std::basic_string<_CharT, _Traits, Alloc>::length, std::allocator >())))._gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+ >((* &7))â (type â__gnu_cxx::__normal_iterator >â) to type âstd::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}â
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:54:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1230:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1230:7: note: no known conversion for argument 1 from â__gnu_cxx::__normal_iterator >â to âstd::basic_string::size_type {aka unsigned int}â
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1252:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1252:7: note: candidate expects 4 arguments, 2 provided
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:55:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.tcc:361:6: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.tcc:361:6: note: candidate expects 3 arguments, 2 provided
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/string:54:0,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/locale_classes.h:42,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ios:43,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/ostream:40,
from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/iostream:40,
from main3.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1293:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1293:7: note: no known conversion for argument 1 from â__gnu_cxx::__normal_iterator >â to âstd::basic_string::size_type {aka unsigned int}â
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1316:7: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc> = std::basic_string; std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1316:7: note: candidate expects 3 arguments, 2 provided
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1334:7: note: std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::insert(std::basic_string<_CharT, _Traits, _Alloc>::iterator, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/basic_string.h:1334:7: note: no known conversion for argument 1 from â__gnu_cxx::__normal_iterator >â to âstd::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}â
I know that the type of p->first is not the one which insert function accepts. but I don't know how to convert these to each other.
The issue might be your usage of std::string::insert. I can't see an insert(iterator, string) version among it's numerous overloads.
You might want to call desired version by explicitly stating length of char array:
void insert (iterator p, size_t n, char c)
The problem seems to be that boost is configured for use with a different version of the compiler rather than the one you are currently using.
Could you add the details of how you compiled it as well?