c2440 error when compiling rtt in visual studio 2013 and 2010

Hi, I need to install orocos-rtt (I downloaded orocos-rtt-toolchain-2.6.0 sources) on windows 7. I have followed the instructions given on http://www.orocos.org/wiki/rtt/rtt-ms-windows/compiling-windows-visual-studio with the following exceptions: I used Visual Studio Express 2013 instead of Vs2008 or 2005. I used boost v.1.57 instead of 1.40 (with which I was not able to generate the rtt solution). When configuring the rtt solution in cmake-gui, I had to remove the findboost.cmake given by orocos-rtt (in rtt/config) so that cmake would use its own and then, I put by hand the path for the boost libraries to the right dlls. I have then successfully generated the solution with cmake-gui (with boost v1.57 only). However when I tried to build the ALL_BUILD project, using Visual Studio 2013, I got the following error, followed by many more of the same kind:

"error C2440: 'return' : cannot convert from 'RTT::base::DataSourceBase::shared_ptr' to 'bool' (C:\Orocos\orocos-toolchain-2.6.0\rtt\rtt\ConnPolicy.cpp)"

I also tried with the Visual studio 2010 compiler but got the same error. Morevoer, it seems this downcast error is generated by the compiler since VS2008 at least, with which Orocos is known to be correctly built.

I got the same problem by trying to install a previous version of rtt (v1.12).

Has someone encountered the same problem and found a fix for it ?

Thanks in advance,

Laurent

c2440 error when compiling rtt in visual studio 2013 and 2010

I guess it is something related to the fact that some C++11 features are
enabled
by default on newer Visual Studio version, and a well known issue in
implicitly
converting boost::shared_ptr to bool in C++11 .

You have to explicitly cast the shared_ptr to bool and everything will work
again
(this change should be compatibile also with old compilers).

On Thu, Dec 11, 2014 at 8:27 AM, <laurentf [dot] dolle [..] ...> wrote:

> Hi,
> I need to install orocos-rtt (I downloaded orocos-rtt-toolchain-2.6.0
> sources) on windows 7. I have followed the instructions given on
>
> http://www.orocos.org/wiki/rtt/rtt-ms-windows/compiling-windows-visual-s...
> with the following exceptions:
> I used Visual Studio Express 2013 instead of Vs2008 or 2005.
> I used boost v.1.57 instead of 1.40 (with which I was not able to generate
> the rtt solution).
> When configuring the rtt solution in cmake-gui, I had to remove the
> findboost.cmake given by orocos-rtt (in rtt/config) so that cmake would use
> its own
> and then, I put by hand the path for the boost libraries to the right dlls.
> I have then successfully generated the solution with cmake-gui (with boost
> v1.57 only).
> However when I tried to build the ALL_BUILD project, using Visual Studio
> 2013, I got the following error, followed by many more of the same kind:
>
> "error C2440: 'return' : cannot convert from
> 'RTT::base::DataSourceBase::shared_ptr' to 'bool'
> (C:\Orocos\orocos-toolchain-2.6.0\rtt\rtt\ConnPolicy.cpp)"
>
> I also tried with the Visual studio 2010 compiler but got the same error.
> Morevoer, it seems this downcast error is generated by the compiler since
> VS2008 at least, with which Orocos is known to be correctly built.
>
> I got the same problem by trying to install a previous version of rtt
> (v1.12).
>
> Has someone encountered the same problem and found a fix for it ?
>
> Thanks in advance,
>
> Laurent
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Linking problem with boost::filesystem::file_status

Thank you ! It fixed part of the problem. I had other compilation errors that I could solve by commenting some parts (rint.hpp, rint.cpp had to be commented). But now, the linking fails with the following error (followed by many of the same kind):

error LNK2001: unresolved external symbol "class boost::filesystem::file_status __fastcall boost::filesystem::detail::status_api(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::system::error_code &)" (?status_api@detail@filesystem@boost@@YI?AVfile_status@23@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAVerror_code@system@3@@Z) C:\Orocos\build\rtt\ComponentLoader.obj orocos-rtt-win32_dynamic

From what I understand, it might be because boost libraries where compiled with the wrong arguments (and that would also explain some compilation errors). Mine are currently:

.\bjam.exe install --prefix=C:\boost --build-type=complete toolset=gcc --j4 link=shared threading=multi --ignore-python --ignore-mpi --layout=tagged

Are these arguments right, or am I missing something ?

Linking problem with boost::filesystem::file_status

I tried to build boost with toolset=msvc12.0 as an argument instead of gcc and the compilation of the project orocos-rtt-win32_dynamic has been successfully built ! Now I have to fix errors for rtt-marshalling...

Linking problem with boost::filesystem::file_status

Well, after having successfully built orocos-rtt-win32_dynamic lib, I am still stuck on several errors when compiling the 3 others plugins (marshalling, scripting, typekit).

On rtt-scripting-win32_plugin:

error C2668: 'boost::mem_fn' : ambiguous call to overloaded function (C:\Orocos\orocos-toolchain-2.6.0\rtt\rtt\scripting\StateMachineService.cpp)

and

error C2780: 'bool boost::detail::function::basic_vtable2<R,T0,T1>::assign_to(const boost::reference_wrapper<F2> &,boost::detail::function::function_buffer &,boost::detail::function::function_obj_ref_tag)' : 3 expected arguments - 2 were passed

It seems the compiler cannot differentiate between the different overloads of assign_to, but how to precise which overload to use ?

On rtt-marshalling-win32_plugin:

error LNK2001: unresolved external symbol "public: __thiscall RTT::base::OperationCallerInterface::OperationCallerInterface(void)" (??0OperationCallerInterface@base@RTT@@QAE@XZ)

...followed by 7 other unresolved symbols. This time, it does not relate to boost, and I cannot figure out what's wrong, although I confusely sense it might have something to do with the way orocos-rtt-win32_dynamic has been built ?

rtt-typekit-win32_plugin sends the same kind of error...

Any suggestion would be appreciated, thanks !

Laurent