Page 1 of 1

Tado.cpp compiler error.....

Posted: Thursday 19 April 2018 15:17
by SiSu82
Moving to a fresh install of Ubuntu 16.04 LTS on a vmware machine. Updated everything on Ubuntu and followed the stepps in the installation guide and it worked well until around 67% when it tried to compile the Tado.CPP

Any suggestions?

Code: Select all

In file included from /usr/include/c++/5/regex:35:0,
                 from /home/xyzzyx/domoticz/hardware/Tado.cpp:25:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
/home/xyzzyx/domoticz/hardware/Tado.cpp: In member function ‘bool CTado::MatchValueFromJSKey(std::__cxx11::string, std::__cxx11::string, std::__cxx11::string&)’:
/home/xyzzyx/domoticz/hardware/Tado.cpp:578:2: error: ‘match_results’ is not a member of ‘std’
  std::match_results<std::string::const_iterator> _Matches;
  ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:578:2: note: suggested alternative:
In file included from /usr/include/boost/asio/read_until.hpp:26:0,
                 from /usr/include/boost/asio.hpp:91,
                 from /home/xyzzyx/domoticz/hardware/../main/../tcpserver/TCPClient.h:3,
                 from /home/xyzzyx/domoticz/hardware/../main/../tcpserver/TCPServer.h:4,
                 from /home/xyzzyx/domoticz/hardware/../main/mainworker.h:11,
                 from /home/xyzzyx/domoticz/hardware/Tado.cpp:21:
/usr/include/boost/asio/detail/regex_fwd.hpp:29:7: note:   ‘boost::match_results’
 class match_results;
       ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:578:48: error: expected primary-expression before ‘>’ token
  std::match_results<std::string::const_iterator> _Matches;
                                                ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:578:50: error: ‘_Matches’ was not declared in this scope
  std::match_results<std::string::const_iterator> _Matches;
                                                  ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:581:2: error: ‘regex’ is not a member of ‘std’
  std::regex _reSearch(sKeyName + ": '(.*?)'");
  ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:581:2: note: suggested alternative:
In file included from /usr/include/boost/regex_fwd.hpp:27:0,
                 from /usr/include/boost/asio/detail/regex_fwd.hpp:20,
                 from /usr/include/boost/asio/read_until.hpp:26,
                 from /usr/include/boost/asio.hpp:91,
                 from /home/xyzzyx/domoticz/hardware/../main/../tcpserver/TCPClient.h:3,
                 from /home/xyzzyx/domoticz/hardware/../main/../tcpserver/TCPServer.h:4,
                 from /home/xyzzyx/domoticz/hardware/../main/mainworker.h:11,
                 from /home/xyzzyx/domoticz/hardware/Tado.cpp:21:
/usr/include/boost/regex/v4/regex_fwd.hpp:60:48: note:   ‘boost::regex’
 typedef basic_regex<char, regex_traits<char> > regex;
                                                ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:582:7: error: ‘regex_search’ is not a member of ‘std’
  if (!std::regex_search(sJavascriptData, _Matches, _reSearch)) {
       ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:582:52: error: ‘_reSearch’ was not declared in this scope
  if (!std::regex_search(sJavascriptData, _Matches, _reSearch)) {
                                                    ^
/home/xyzzyx/domoticz/hardware/Tado.cpp: In member function ‘bool CTado::GetTadoApiEnvironment(std::__cxx11::string)’:
/home/xyzzyx/domoticz/hardware/Tado.cpp:607:2: error: ‘match_results’ is not a member of ‘std’
  std::match_results<std::string::const_iterator> _Matches;
  ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:607:2: note: suggested alternative:
In file included from /usr/include/boost/asio/read_until.hpp:26:0,
                 from /usr/include/boost/asio.hpp:91,
                 from /home/xyzzyx/domoticz/hardware/../main/../tcpserver/TCPClient.h:3,
                 from /home/xyzzyx/domoticz/hardware/../main/../tcpserver/TCPServer.h:4,
                 from /home/xyzzyx/domoticz/hardware/../main/mainworker.h:11,
                 from /home/xyzzyx/domoticz/hardware/Tado.cpp:21:
/usr/include/boost/asio/detail/regex_fwd.hpp:29:7: note:   ‘boost::match_results’
 class match_results;
       ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:607:48: error: expected primary-expression before ‘>’ token
  std::match_results<std::string::const_iterator> _Matches;
                                                ^
/home/xyzzyx/domoticz/hardware/Tado.cpp:607:50: error: ‘_Matches’ was not declared in this scope
  std::match_results<std::string::const_iterator> _Matches;
                                                  ^
CMakeFiles/domoticz.dir/build.make:3662: recipe for target 'CMakeFiles/domoticz.dir/hardware/Tado.cpp.o' failed
make[2]: *** [CMakeFiles/domoticz.dir/hardware/Tado.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:103: recipe for target 'CMakeFiles/domoticz.dir/all' failed
make[1]: *** [CMakeFiles/domoticz.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Re: Tado.cpp compiler error.....

Posted: Thursday 19 April 2018 20:27
by SweetPants
I think this is related to https://github.com/domoticz/domoticz/pull/2334 I think you should upgrade GCC. I'm using GCC 6.3 on 16.04 LTS

Re: Tado.cpp compiler error.....

Posted: Saturday 21 April 2018 0:19
by dotms
Above is correct. In the development a c++11 feature was used, even though not explicitly specified in the build scripts. Most compilers will compile it anyway.

Problem is that the gcc compiler that comes with Ubuntu 16.04 is rather old and does not handle this gracefully as you discovered. A fix to use the boost libraries instead of the standard c++ libraries has been made, it only needs to be merged into the development tree by a Domoticz project maintainer.

Until this is done the best way to compile is installing a more recent version of gcc (howto: https://gist.github.com/application2000 ... 56315a2d91).