Reputation: 3625
I have a code that looks like this:
void handle_get(http_request request)
{
TRACE(L"\nhandle GET\n");
std::vector< std::pair< utility::string_t, json::value > > answer;
for(auto const & p : dictionary)
{
answer.push_back(std::make_pair(p.first, json::value(p.second)));
}
request.reply(status_codes::OK, json::value::object(answer));
};
And I get an
undefined reference to `web::json::value::object(std::vector<std::pair<std::string, web::json::value>, std::allocator<std::pair<std::string, web::json::value> > >, bool)'
I do not understand why doesn't it see that answer
has no std::string
?
std::map< utility::string_t, utility::string_t > dictionary;
I do not understand why it does not see the definition of object(std::vector< std::pair< utility::string_t, json::value > >)
(I have included cpprest/json.h
)?
Upvotes: 1
Views: 1616
Reputation: 171413
I do not understand why doesn't it see that answer has no std::string?
Obviously utility::string_t
is a typedef for std::string
and the compiler is showing the real type, not the typedef name (although in this case the real name is std::basic_string<char>
, but the compiler has a special rule to show that as the more common name std::string
).
Upvotes: 4