Arvind Kanjariya
Arvind Kanjariya

Reputation: 2097

RapidJson undefined reference

in function rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::GenericDocument(rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&):

    error: undefined reference to 'rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::GenericValue(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&)'

I am facing this error while using rapidjson library in cocos2dX.

Upvotes: 6

Views: 1911

Answers (2)

stephen Sun
stephen Sun

Reputation: 1

deep copy not allowed,pleased use reference. such as

void parseJsonDocument(const char* data, rapidjson::Document& json);
const rapidjson::Value& itemValue = value["value"];

Upvotes: 0

user3738806
user3738806

Reputation: 31

This question was asked a while ago, recording the answer here for anyone else with the same problem.

If you are passing a rapidjson::Document into a function, try passing by reference. i.e. instead of void doSomething(rapidjson::Document doc) write void doSomething(rapidjson::Document &doc). I think there is an issue with using the rapidjson::Document copy constructor.

Upvotes: 3

Related Questions