takayan660 / RobotArm_Simulator

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

choreonoid 1.6 make error #1

Closed takayan660 closed 7 years ago

takayan660 commented 7 years ago

以下のサイトを参考にトルク指令を実装したところ、以下のエラーが出てきた 以下のエラーは#include <cnoid/MultiValueSeq>のみを追加した場合

参考: RTコンポーネントにおけるトルク指令の入力

[taka]:RobotArmAngleControlRTC master $ make
-- OpenRTMConfig.cmake found.
-- Configrued by configuration mode.
-- OpenRTM-aist configuration done
-- OpenRTM configuration Found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/taka/projects/RobotArm_Simulator/choreonoid/rtc/RobotArmAngleControlRTC
[  0%] Built target ALL_IDL_TGT
[ 33%] Building CXX object src/CMakeFiles/RobotArmAngleControlRTC.dir/RobotArmAngleControlRTC.cpp.o
In file included from /usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiSeq.h:9:0,
                 from /usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiValueSeq.h:9,
                 from /usr/local/include/choreonoid-1.6/cnoid/MultiValueSeq:1,
                 from /home/taka/projects/RobotArm_Simulator/choreonoid/rtc/RobotArmAngleControlRTC/include/RobotArmAngleControlRTC/RobotArmAngleControlRTC.h:16,
                 from /home/taka/projects/RobotArm_Simulator/choreonoid/rtc/RobotArmAngleControlRTC/src/RobotArmAngleControlRTC.cpp:10:
/usr/local/include/choreonoid-1.6/cnoid/src/Util/AbstractSeq.h:20:9: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
 typedef std::shared_ptr<AbstractSeq> AbstractSeqPtr;
         ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/AbstractSeq.h:32:13: error: ‘AbstractSeqPtr’ does not name a type
     virtual AbstractSeqPtr cloneSeq() const = 0;
             ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/AbstractSeq.h:129:13: error: ‘AbstractSeqPtr’ does not name a type
     virtual AbstractSeqPtr cloneSeq() const = 0;
             ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/AbstractSeq.h:145:13: error: ‘function’ in namespace ‘std’ does not name a type
     typedef std::function<void(const std::string& label, int index)> SetPartLabelFunction;
             ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/AbstractSeq.h:146:52: error: ‘SetPartLabelFunction’ has not been declared
     bool readSeqPartLabels(const Mapping& archive, SetPartLabelFunction setPartLabel);
                                                    ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/AbstractSeq.h:150:9: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
 typedef std::shared_ptr<AbstractMultiSeq> AbstractMultiSeqPtr;
         ^
In file included from /usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiValueSeq.h:9:0,
                 from /usr/local/include/choreonoid-1.6/cnoid/MultiValueSeq:1,
                 from /home/taka/projects/RobotArm_Simulator/choreonoid/rtc/RobotArmAngleControlRTC/include/RobotArmAngleControlRTC/RobotArmAngleControlRTC.h:16,
                 from /home/taka/projects/RobotArm_Simulator/choreonoid/rtc/RobotArmAngleControlRTC/src/RobotArmAngleControlRTC.cpp:10:
/usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiSeq.h:27:13: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
     typedef std::shared_ptr< MultiSeqType > Ptr;
             ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiSeq.h:72:13: error: ‘AbstractSeqPtr’ does not name a type
     virtual AbstractSeqPtr cloneSeq() const {
             ^
In file included from /usr/local/include/choreonoid-1.6/cnoid/MultiValueSeq:1:0,
                 from /home/taka/projects/RobotArm_Simulator/choreonoid/rtc/RobotArmAngleControlRTC/include/RobotArmAngleControlRTC/RobotArmAngleControlRTC.h:16,
                 from /home/taka/projects/RobotArm_Simulator/choreonoid/rtc/RobotArmAngleControlRTC/src/RobotArmAngleControlRTC.cpp:10:
/usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiValueSeq.h:19:13: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
     typedef std::shared_ptr<MultiValueSeq> Ptr;
             ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiValueSeq.h:20:13: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
     typedef std::shared_ptr<const MultiValueSeq> ConstPtr;
             ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiValueSeq.h:27:13: error: ‘AbstractSeqPtr’ does not name a type
     virtual AbstractSeqPtr cloneSeq() const;
             ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiValueSeq.h:37:9: error: ‘Ptr’ in ‘class cnoid::MultiValueSeq’ does not name a type
 typedef MultiValueSeq::Ptr MultiValueSeqPtr;        
         ^
/usr/local/include/choreonoid-1.6/cnoid/src/Util/MultiValueSeq.h:38:9: error: ‘ConstPtr’ in ‘class cnoid::MultiValueSeq’ does not name a type
 typedef MultiValueSeq::ConstPtr ConstMultiValueSeqPtr;
         ^
make[2]: *** [src/CMakeFiles/RobotArmAngleControlRTC.dir/RobotArmAngleControlRTC.cpp.o] エラー 1
make[1]: *** [src/CMakeFiles/RobotArmAngleControlRTC.dir/all] エラー 2
make: *** [all] エラー 2
takayan660 commented 7 years ago

C++のバージョンを固定するとうまく行くので以下のサイトを参考にCMakeLists.txtとsrc/CMakeLists.txtに以下のコードを追加することで解決した

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
        message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

参考: Enabling C++11 (C++0x) in CMake ビルドに失敗する (Choreonoid 325d8c3 使用)

takayan660 commented 7 years ago

解決したので閉じます

takayan660 commented 7 years ago

f433f882da90d332130831b199dd65bc0489796