ubuntu在eclipse 中 用yaml-cpp 库 让eclipse支持C++11特性

https://github.com/jbeder/yaml-cpp

今天想使用yaml-cpp库。下载安装后,ubuntu在eclipse下配好工程后,各种错误。想到是c++11特性的问题。

错误信息太多了,截取一部分如下:

/usr/local/include/yaml-cpp/node/detail/impl.h: At global scope:
/usr/local/include/yaml-cpp/node/detail/impl.h:162:47: error: ‘shared_memory_holder’ has not been declared
 inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
                                               ^
/usr/local/include/yaml-cpp/node/detail/impl.h: In member function ‘bool YAML::detail::node_data::remove(const Key&, int)’:
/usr/local/include/yaml-cpp/node/detail/impl.h:168:31: error: ‘next’ is not a member of ‘std’
       kv_pairs::iterator jt = std::next(it);
                               ^
/usr/local/include/yaml-cpp/node/detail/impl.h: At global scope:
/usr/local/include/yaml-cpp/node/detail/impl.h:189:37: error: ‘shared_memory_holder’ has not been declared
                                     shared_memory_holder pMemory) {
                                     ^
/usr/local/include/yaml-cpp/node/detail/impl.h:209:41: error: ‘shared_memory_holder’ has not been declared
                                         shared_memory_holder pMemory) {
                                         ^
/usr/local/include/yaml-cpp/node/detail/impl.h: In static member function ‘static YAML::detail::node& YAML::detail::node_data::convert_to_node(const T&, int)’:
/usr/local/include/yaml-cpp/node/detail/impl.h:212:10: error: base operand of ‘->’ is not a pointer
   pMemory->merge(*value.m_pMemory);
          ^
/usr/local/include/yaml-cpp/node/detail/impl.h:212:25: error: ‘class YAML::Node’ has no member named ‘m_pMemory’
   pMemory->merge(*value.m_pMemory);
                         ^
make: *** [src/yamldemo.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

Project->Properties->C/C++ Build->Settings->GCC G++ Compiler->Miscellaneous->Other flags 将-c -fmessage-length=0 改为 -c -fmessage-length=0 -std=c++11

 

 

好了


版权声明:本文为CAIYUNFREEDOM原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。