Complete Example Yaml program on http://code.google.com/p/yaml-cpp/wiki/HowToParseADocument does not compile

StackOverflow https://stackoverflow.com/questions/14365505

  •  16-01-2022
  •  | 
  •  

質問

Using G++ 4.6.2 on Linux Library was built according to instructions. run_tests in test directory works fine.

setenv YAML_HOME /nfs/site/proj/dt/ltt_test_15/work_area/ironchef/new_version/ironchef/trunk/yaml/yaml-cpp-0.5.0

ls $YAML_HOME total 640 16 CMakeCache.txt 0 build/ 0 libyaml-cpp.so.0.5@ 8 test/ 8 CMakeFiles/ 8 cmake_install.cmake 480 libyaml-cpp.so.0.5.0* 8 util/ 16 CMakeLists.txt 0 include/ 8 license.txt 8 yaml-cpp.pc 8 CTestTestfile.cmake 8 install.txt 8 matt_sandbox/ 8 yaml-cpp.pc.cmake 40 Makefile 0 libyaml-cpp.so@ 8 src/

cd matt_sandbox g++ -o test_yaml -g -I/usr/intel/pkgs/boost/1.48.0-gcc-4.6.2/include -I$YAML_HOME/include -I$YAML_HOME/include/yaml-cpp -I$YAML_HOME/include/yaml-cpp/node -I$YAML_HOME/include/yaml-cpp/node/detail -I$YAML_HOME/include/yaml-cpp/contrib main.cpp

Compiler errors: main.cpp: In function `void operator>>(const YAML::Node&, Vec3&)': main.cpp:25: error: no match for 'operator>>' in 'YAML::Node::operator[](const Key&) const [with ... similar errors .... main.cpp:51: error: 'class YAML::Parser' has no member named 'GetNextDocument'

Copy-and-paste code from complete example on http://code.google.com/p/yaml-cpp/wiki/HowToParseADocument

役に立ちましたか?

解決

That example uses the old API (version 0.3.0), but you're using the new API (version 0.5.0). I've updated the main page to make that clear.

For examples using the new API, see http://code.google.com/p/yaml-cpp/wiki/Tutorial.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top