raisimTech / raisimOgre

Other
26 stars 21 forks source link

Compilation error: expression cannot be used as a function #19

Closed ShantihBlah closed 3 years ago

ShantihBlah commented 3 years ago

Hello! When I compile the raisimOgre by running the last step —— “make install -j8”, I find the following error and fail to compile it:

[ 81%] Building CXX object CMakeFiles/raisimOgre.dir/src/OgreVis.cpp.o
In file included from /home/weilang/raisim_build/include/raisim/math/Core.hpp:13,
                 from /home/weilang/raisim_build/include/raisim/math.hpp:17,
                 from /home/weilang/raisim_build/include/raisim/object/Object.hpp:12,
                 from /home/weilang/raisim_build/include/raisim/World.hpp:13,
                 from /home/weilang/raisim_workspace/raisimOgre/include/raisim/interfaces.hpp:12,
                 from /home/weilang/raisim_workspace/raisimOgre/include/raisim/OgreVis.hpp:29,
                 from /home/weilang/raisim_workspace/raisimOgre/src/OgreVis.cpp:15:
/home/weilang/raisim_build/include/raisim/math/Matrix.hpp: In instantiation of ‘raisim::Mat<n, m>::Mat(const T2&) [with T2 = raisim::Mat<3, 1>*; long unsigned int n = 3; long unsigned int m = 1]’:
/home/weilang/raisim_workspace/raisimOgre/src/OgreVis.cpp:1271:75:   required from here
/home/weilang/raisim_build/include/raisim/math/Matrix.hpp:55:117: error: expression cannot be used as a function
   55 |   Mat(const T2 &rhs) { for (size_t i = 0; i < rows(); ++i) for (size_t j = 0; j < cols(); ++j) operator()(i,j) = rhs(i,j); }
      |                                                                                                                  ~~~^~~~~
make[2]: *** [CMakeFiles/raisimOgre.dir/build.make:154: CMakeFiles/raisimOgre.dir/src/OgreVis.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:207: CMakeFiles/raisimOgre.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

(From 70b753d68145fc2868ab5921a30fced7891dc7f2)

jhwangbo commented 3 years ago

which OS, compiler, CPU did you use?

ShantihBlah commented 3 years ago

OS: ubuntu20.04; Compiler: g++9.0; CPU: 16 (cores) AMD RYZEN 7 4800H.

jhwangbo commented 3 years ago

Did you update both raisimLib and raisimOgre to the latest version?

ShantihBlah commented 3 years ago

The raisimOgre I used is the latest, but the raisimLib is not. I will update it and try again.

ShantihBlah commented 3 years ago

It works! Thank you very much!