aldebaran / libqi

NAOqi core framework
http://doc.aldebaran.com/libqi/
BSD 3-Clause "New" or "Revised" License
66 stars 53 forks source link

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

Closed xuyuan closed 10 years ago

xuyuan commented 10 years ago

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_FORMATELEM, , __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 QICAT(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 ‘QICAT

define QI_CAT(A, B) QICAT(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_FORMATHASARG, _QI_LOG_ISEMPTY(__VA_ARGS__))(Msg, VA_ARGS)

......

blastrock commented 10 years ago

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.

xuyuan commented 10 years ago

gnu++0x works, thank you

hu7241 commented 8 years ago

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