dimanche 3 décembre 2017

'http': a namespace with this name does not exist C++ rest SDK

I'm working on a project which is using C++ RESTAPI. Im follwing Casablanca tutorial. According to that tutorial I added Casablanca to my C++ console aplication project using NuGet package manager. I am using Visual Studio 2015 Enterprise Edition. I am getting errors when I try to build my solution that 'http': a namespace with this name does not exist


'web': a namespace with this name does not exist

'web': is not a class or namespace name

'http': a namespace with this name does not exist

'web': is not a class or namespace name

'client': a namespace with this name does not exist

'concurrency': is not a class or namespace name

'streams': a namespace with this name does not exist. enter image description here 'make_shared': is not a member of 'std'

enter code here
// RESTProject.cpp : Defines the entry point for the console application.
//
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#include <fstream>
#include <iostream>
#include "stdafx.h"

using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;
using namespace std;

int main()
{
    auto filestream = std::make_shared<concurrency::streams::ostream>();
    pplx::task<void> requesttask =concurrency::streams::fstream::open_ostream(U("result.html")).then([=](concurrency::streams::ostream outfile)
    {
        *filestream = outfile;


        // Create http_client to send the request.
        http_client client(U("http://www.bing.com/"));

        // Build request URI and start the request.
        uri_builder builder(U("/search"));
        builder.append_query(U("q"), U("cpprestsdk github"));
        return client.request(methods::GET, builder.to_string());
    });
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire