aldebaran / libqi

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

Compiling libqi with Visual Studio 2015... #11

Closed rlyle closed 3 years ago

rlyle commented 8 years ago

So, i've almost got libqi building under Visual Studio 2015... I'm down to one last compile error, just wondering if you've seen this issue before:

------ Build started: Project: libqi, Configuration: Debug Win32 ------ 1> eventloop.cpp 1>c:\work\ibm\self\lib\libqi\src\eventloop.cpp(324): error C2672: 'boost::chrono::duration_cast': no matching overloaded function found 1>c:\work\ibm\self\lib\libqi\src\eventloop.cpp(324): error C2770: invalid explicit template argument(s) for 'boost::enable_ifboost::chrono::detail::is_duration<T,ToDuration>::type boost::chrono::duration_cast(const boost::chrono::duration<Rep2,Period> &)' 1> c:\work\ibm\self\lib\boost_1_60_0\boost\chrono\duration.hpp(786): note: see declaration of 'boost::chrono::duration_cast' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I'm compiling with the latest version of Boost - 1.60.0

alkino commented 8 years ago

Hi o/

Thanks to try such things. We don't officially support boost 1.60 or VS2015 but we can help you anyway. I compile with boost 1.55 / VS 2015 and with boost 1.60 / VS 2013 but no both together.

Can you give us the sha1 of libqi you're compiling for?

rlyle commented 8 years ago

Not sure how to give you the SHA1, but I'm using libqi as a submodule off the "release-2.4" branch.

rlyle commented 8 years ago

Ok, finally got it to compile by commenting out a single line in the boost 1.60 implementation..

boost\asio\detail\config.hpp line 339 //# define BOOST_ASIO_HAS_STD_CHRONO 1

After fixing that, then I hit this error: 1>c:\work\ibm\self\lib\libqi\src\sdklayout-boost.cpp(549): error C2668: 'anonymous-namespace'::relative': ambiguous call to overloaded function 1> c:\work\ibm\self\lib\libqi\src\sdklayout-boost.cpp(48): note: could be 'std::stringanonymous-namespace'::relative(const boost::filesystem::path &,const boost::filesystem::path &)' 1> c:\work\ibm\self\lib\boost_1_60_0\boost\filesystem\operations.hpp(692): note: or 'boost::filesystem::path boost::filesystem::relative(const boost::filesystem::path &,boost::system::error_code &)' [found using argument-dependent lookup] 1> c:\work\ibm\self\lib\boost_1_60_0\boost\filesystem\operations.hpp(689): note: or 'boost::filesystem::path boost::filesystem::relative(const boost::filesystem::path &,const boost::filesystem::path &)' [found using argument-dependent lookup] 1> c:\work\ibm\self\lib\libqi\src\sdklayout-boost.cpp(549): note: while trying to match the argument list '(boost::filesystem::path, const boost::filesystem::path)'

I was able to fix that by putting a :: in front of the relative to make sure it used the global namespace.

alkino commented 8 years ago

I have no information about BOOST_ASIO_HAS_STD_CHRONO but about "relative" we already fix that in 2.5 : https://github.com/aldebaran/libqi/commit/a3672cee0da8ad00dc54955be7c51c2c13a196e2

rlyle commented 8 years ago

Yeah, I think the new 2015 includes some boost constructs, the qi::Duration has trouble with the duration_cast<> template function.

Klaim commented 8 years ago

Hi, I'm mostly the only Windows developer on libqi so I feel you pain. I don't know your last exact error, but keep in mind that qi::Duration is a specifci duration type. It's an instance of boost::chrono::duration<..> as you can see in the code.

I don't have time yet to check the VS 2015 compilation of libqi, but if you have this kidn of issue, it might be because of wrong casts going on, OR a problem with the change of some C++ language features in VS2015.

Could you clarify what is the error log exactly?

rlyle commented 8 years ago

Just needed to add BOOST_ASIO_DISABLE_STD_CHRONO define to fix the issue. If I had looked in the CMakeLists.txt file for libqi I would have discovered the fix sooner :)