Cannot open include file: 'cpprest/http_client

2019-07-01 14:21发布

I'm trying to run c++ windows application using casablanca 'c++ rest sdk' for REST requests. I've created new 'CLR Empty Project' (visual studio 2012) and added new item - 'Windows Form'. added some code and was able to see a form when running the projects. now, I have installed the c++ rest sdk using NuGet, as the instructions tell. it all went successfully. the problem is that in order to use the 'c++ rest sdk' I've added these:

#include <cpprest/http_client.h>
#include <cpprest/filestream.h> 

and it doesn't find those files. I'm getting

fatal error C1083: Cannot open include file: 'cpprest/http_client.h': No   such file or directory

Project screenshot: project screenshot

thanks!

3条回答
做个烂人
2楼-- · 2019-07-01 14:38

Check if you have set up the include directories for the headers. You can do it under project properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories.

查看更多
smile是对你的礼貌
3楼-- · 2019-07-01 14:39

I have faced the same problems like you. Even i set my project properties manually, i could see linking errors.

And i could find an article on their official forum.

https://casablanca.codeplex.com/discussions/644534

Yes, we've removed VS 2012 binaries from the package. I recommend trying out VS 2015 community, which can be downloaded for free from: https://www.visualstudio.com/downloads/download-visual-studio-vs.

I have tested it on the same way on VS2015 community IDE. The package is working perfectly.

查看更多
干净又极端
4楼-- · 2019-07-01 14:52

you have to include this path :

C:\YourProject\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\include

and:

C:\YourProject\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\lib

I've got the same issue after I added the NuGet package. The include and lib folders are not linked automatically as the description says.

查看更多
登录 后发表回答