本文介绍了Rapidjson无法复制`rapidjson :: Document`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个构造rapidjson::Document
并返回的函数.但是当我用这个原型编写一个函数时:
I need a function that constructs a rapidjson::Document
and returns. But when I write a function with this prototype:
rapidjson::Document progressToJson(const Progress& progress);
我收到此错误:
error LNK2019: unresolved external symbol "private: __thiscall rapidjson::GenericValue<struct rapidjson::UTF8<char>,class rapidjson::MemoryPoolAllocator<class rapidjson::CrtAllocator> >::GenericValue<struct rapidjson::UTF8<char>,class rapidjson::MemoryPoolAllocator<class rapidjson::CrtAllocator> >(class rapidjson::GenericValue<struct rapidjson::UTF8<char>,class rapidjson::MemoryPoolAllocator<class rapidjson::CrtAllocator> > const &)" (??0?$GenericValue@U?$UTF8@D@rapidjson@@V?$MemoryPoolAllocator@VCrtAllocator@rapidjson@@@2@@rapidjson@@AAE@ABV01@@Z) referenced in function "public: __thiscall rapidjson::GenericDocument<struct rapidjson::UTF8<char>,class rapidjson::MemoryPoolAllocator<class rapidjson::CrtAllocator> >::GenericDocument<struct rapidjson::UTF8<char>,class rapidjson::MemoryPoolAllocator<class rapidjson::CrtAllocator> >(class rapidjson::GenericDocument<struct rapidjson::UTF8<char>,class rapidjson::MemoryPoolAllocator<class rapidjson::CrtAllocator> > const &)" (??0?$GenericDocument@U?$UTF8@D@rapidjson@@V?$MemoryPoolAllocator@VCrtAllocator@rapidjson@@@2@@rapidjson@@QAE@ABV01@@Z)
似乎没有复制构造函数.我怎么解决这个问题?顺便说一句,当我使用Eclipse作为Android本机代码编译它时,它便可以编译并正常工作. Windows上的MVS 2012出现此错误.
Seems there is not copy constructor. How can I solve this problem? BTW when I compile this with Eclipse as an Android Native code, it compiles and works. I get this error with MVS 2012 on Windows.
推荐答案
传递一个空文档作为参数,并尝试使用其内存分配器对其进行解析:
Pass an empty document as argument and try to parse into it with its memory allocator:
void progressToJson(const Progress & progress, rapidjson::Document & doc);
这篇关于Rapidjson无法复制`rapidjson :: Document`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!