aldebaran / libqi

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

Boost static assert to c++11 static assert #8

Closed NoiZeR355 closed 8 years ago

NoiZeR355 commented 9 years ago

Hi

I want to compile libqi but i get errors with the last version.

[ 1%] Building CXX object CMakeFiles/qi.dir/src/future.cpp.o In file included from /home/arne/Documents/Dev/arne/libqi-master/qi/type/typeinterface.hpp:381:0, from /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/anyreference.hpp:376, from /home/arne/Documents/Dev/arne/libqi-master/qi/anyvalue.hpp:10, from /home/arne/Documents/Dev/arne/libqi-master/qi/detail/future_fwd.hpp:17, from /home/arne/Documents/Dev/arne/libqi-master/qi/future.hpp:7, from /home/arne/Documents/Dev/arne/libqi-master/src/future.cpp:5: /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:3: warning: identifier ‘static_assert’ is a keyword in C++11 [-Wc++0x-compat] static_assert(!boost::is_same<T,bool>::value, "std::vector is not supported by AnyValue."); ^ In file included from /home/arne/Documents/Dev/arne/libqi-master/qi/type/typeinterface.hpp:381:0, from /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/anyreference.hpp:376, from /home/arne/Documents/Dev/arne/libqi-master/qi/anyvalue.hpp:10, from /home/arne/Documents/Dev/arne/libqi-master/qi/detail/future_fwd.hpp:17, from /home/arne/Documents/Dev/arne/libqi-master/qi/future.hpp:7, from /home/arne/Documents/Dev/arne/libqi-master/src/future.cpp:5: /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:17: error: expected identifier before ‘!’ token static_assert(!boost::is_same<T,bool>::value, "std::vector is not supported by AnyValue."); ^ /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:17: error: expected ‘,’ or ‘...’ before ‘!’ token /home/arne/Documents/Dev/arne/libqi-master/qi/type/detail/listtypeinterface.hxx:123:98: warning: ISO C++ forbids declaration of ‘static_assert’ with no type [-fpermissive] static_assert(!boost::is_same<T,bool>::value, "std::vector is not supported by AnyValue."); ^ make[2]: * [CMakeFiles/qi.dir/src/future.cpp.o] Error 1 make[1]: * [CMakeFiles/qi.dir/all] Error 2 make: *\ [all] Error 2

Any clue what is wrong?

Thanks in advance

alkino commented 9 years ago

We use c++11 in libqi, now. We will make a fix available soon. Sorry for the inconvenience.

blastrock commented 9 years ago

In the meantime, you can add the flag -std=gnu++0x or gnu++11 manually. You will need to add it to all your projects that use libqi also.

NoiZeR355 commented 9 years ago

How can i add it with cmake because i use now for building my apps qibuild make. Is this the same issue like -std=gnu++0x?

/lib/libqi.so: undefined reference to boost::filesystem::detail::copy_file(boost::filesystem::path const&, boost::filesystem::path const&, boost::filesystem::detail::copy_option, boost::system::error_code*)' //lib/libqi.so: undefined reference toboost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::basic_string<char, std::char_traits, std::allocator >&)' collect2: ld returned 1 exit status CMakeFiles/app.dir/build.make:106: recipe for target 'sdk/bin/app' failed make[2]: * [sdk/bin/app] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/app.dir/all' failed make[1]: * [CMakeFiles/app.dir/all] Error 2 Makefile:116: recipe for target 'all' failed make: *\ [all] Error 2

blastrock commented 9 years ago

Yes, this is a boost bug which makes c++03 and c++11 versions incompatible. There are at least two ways to workaround this:

Another solution would be to upgrade boost, though I never tested that. It seems that the fix was back ported into boost 1.56. Beware that libqi does not support boost above 1.56.

NoiZeR355 commented 9 years ago

I tried both in command line and they don't work. Does i need to add somethings to my project in the cmakefile.txt? Or do something else?

alkino commented 9 years ago

Does not officially support 1.56. I compile it with boost 1.57 sometimes and it works (but it's not officially supported).

alkino commented 8 years ago

If you still have problem open a new issue. Sorry.