aldebaran/libqi

qi::log can not build with c++0x

Closed this issue · 3 comments

In naoqi-sdk-2.1.0.19, when build helloworld with c++0x support (gcc 4.8.2), got the following error:

In file included from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qi/log.hpp:243:0,
from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qitype/typeinterface.hpp:18,
from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qitype/anyfunction.hpp:53,
from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qitype/manageable.hpp:13,
from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qitype/anyobject.hpp:17,
from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/alcommon/alfunctor.h:17,
from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/alcommon/almodulecore.h:21,
from /home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/alcommon/almodule.h:16,
from /media/windows/Users/yuan.xu/Downloads/test/helloworld/helloworld.h:9,
from /media/windows/Users/yuan.xu/Downloads/test/helloworld/helloworld.cpp:5:
/media/windows/Users/yuan.xu/Downloads/test/helloworld/helloworld.cpp: In member function ‘void HelloWorld::sayHello()’:
/home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qi/details/log.hxx:55:46: error: too few arguments to function ‘boost::format qi::log::detail::getFormat(const string&)’
boost::str(::qi::log::detail::getFormat(Msg) QI_VAARGS_APPLY(_QI_FORMAT_ELEM, _, VA_ARGS /**/))
^
/home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qi/details/log.hxx:39:107: note: in definition of macro ‘_qiLogError’

define _qiLogError(...) qi::log::LogStream(qi::LogLevel_Error, FILE, FUNCTION, LINE, VA_ARGS).self()

                                                                                                       ^

/home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qi/preproc.hpp:99:25: note: in expansion of macro ‘_QI_LOG_FORMAT_HASARG_0’

define QI_CAT_(A, B) A ## B

                     ^

/home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qi/preproc.hpp:98:24: note: in expansion of macro ‘QI_CAT_’

define QI_CAT(A, B) QI_CAT_(A, B)

                    ^

/home/xu/Roboter/2.1/naoqi-sdk-2.1.0.19-linux64/include/qi/details/log.hxx:52:3: note: in expansion of macro ‘QI_CAT’
QI_CAT(QI_LOG_FORMAT_HASARG, _QI_LOG_ISEMPTY(VA_ARGS))(Msg, VA_ARGS)

......

It works with C++11 here.
This is not c++11 related, it's because of the use of one gnu extension (also available on visual c++). Compile with -std=gnu++0x or -std=gnu++11.

gnu++0x works, thank you

@blastrock
-std_gnu++11 saves the day, Thanks!