fork download
  1. #include <string>
  2.  
  3. int main()
  4. {
  5. using std::string;
  6. string acidName;
  7. string answerString;
  8. float acidWeight;
  9. answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
  10. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:56: error: no match for 'operator+' (operand types are 'std::basic_string<char>' and 'float')
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                        ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4888:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4888:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   deduced conflicting types for parameter '_CharT' ('char' and 'float')
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4882:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4882:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const _CharT*' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4876:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(_CharT __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4876:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4870:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4870:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4858:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4858:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4852:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4852:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4846:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4846:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4834:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
     ^
/usr/include/c++/5/bits/basic_string.h:4834:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   deduced conflicting types for parameter '_CharT' ('char' and 'float')
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4818:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4818:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const _CharT*' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:53:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.tcc:1167:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
     ^
/usr/include/c++/5/bits/basic_string.tcc:1167:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:53:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.tcc:1151:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/5/bits/basic_string.tcc:1151:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const _CharT*' and 'std::basic_string<char>'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/string:52:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/basic_string.h:4781:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4781:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/string:40,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:1152:5: note: candidate: template<class _Iterator> std::move_iterator<_Iterator> std::operator+(typename std::move_iterator<_Iterator>::difference_type, const std::move_iterator<_Iterator>&)
     operator+(typename move_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/5/bits/stl_iterator.h:1152:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/string:40,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:334:5: note: candidate: template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)
     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/5/bits/stl_iterator.h:334:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/string:40,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:930:5: note: candidate: template<class _Iterator, class _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
     ^
/usr/include/c++/5/bits/stl_iterator.h:930:5: note:   template argument deduction/substitution failed:
prog.cpp:9:58: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'float'
     answerString = "The weight of " + acidName + "is " + acidWeight + "per mole";
                                                          ^
stdout
Standard output is empty