2013-01-05 89 views
2

当我试图使用Visual Studio Express的2012(使用CMake的生成项目文件)编译yaml-cpp 0.5,我从impl.h得到一些错误:YAML-CPP编译器错误试图建立图书馆

error C2734: 'lhs' : const object must be initialized if not extern 
error C2027: use of undefined type 'YAML::convert<T>' 
error C3861: 'decode': identifier not found 
error C3861: 'encode': identifier not found 

所有的错误都是从模板函数node_data::equalsnode_data::convert_to_node

注意,这些错误来自run-tests项目文件即将到来;我实际上能够构建lib文件,但无法使用库,因为它需要这些功能才能工作。

任何想法?

编辑:较2010年VS

回答

0

在VS 2010名字符串const char[]类型,并且导致此编译错误。 对我来说,速战速决是扔在char*

YAML::Node config = YAML::LoadFile("Config.cfg"); 
int value = 0; 
if (config[(char*)"value"]) 
    config[(char*)"value"].as<int>(); 

看起来并不美观,但工作到从图书馆借来的修复会来。