c++restvisual-studio-2015sdkcasablanca

Cannot open include file: 'cpprest/ws_client': No such file or directory


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++ project using NuGet package manager. Im using Visual Studio 2015 Enterprise Edition. But when Including following files it shows error on #include <cpprest/ws_client>. I already set the Additional Include directories, and Additional library Directories form project properties as follows.

Additional Include Directory <project_dir>\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.9.1\build\native\include

Additional library Directories <project_dir>\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.9.1\lib

I added actual screen shots here. How to fix this?enter image description here

#include <iostream>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#include <cpprest/http_listener.h>              // HTTP server
#include <cpprest/json.h>                       // JSON library
#include <cpprest/uri.h>                        // URI library
#include <cpprest/ws_client>                    // WebSocket client
#include <cpprest/containerstream.h>            // Async streams backed by STL containers
#include <cpprest/interopstream.h>              // Bridges for integrating Async streams with STL and WinRT streams
#include <cpprest/rawptrstream.h>               // Async streams backed by raw pointer to memory
#include <cpprest/producerconsumerstream.h>     // Async streams for producer consumer scenarios

using namespace utility;                    // Common utilities like string conversions
using namespace web;                        // Common features like URIs.
using namespace web::http;                  // Common HTTP functionality
using namespace web::http::client;          // HTTP client features
using namespace concurrency::streams;       // Asynchronous streams
using namespace web::http::experimental::listener;          // HTTP server
using namespace web::experimental::web_sockets::client;     // WebSockets client
using namespace web::json;                                  // JSON library 

(I tried with visual Studio 2017,2013 also. But result is same.)


Solution

  • You are not including the header file right, therefore, the reference cannot be resolved: Using #include <cpprest/ws_client.h> instead of #include <cpprest/ws_client> will work for you.