如何使用 Xcode 8.2.1 在我的项目中添加 cpprestsdk 库
How do I add the cpprestsdk library in my project using Xcode 8.2.1
我在Mac上,是Xcode和C++的初学者。我已经使用brew install cpprestsdk
安装了一个库。然后,我将 Xcode 中的标头搜索路径设置为调试和发布/usr/local/Cellar/cpprestsdk/2.9.1/include/cpprest
,以便自动完成工作。
我正在尝试遵循本教程 https://github.com/Microsoft/cpprestsdk/wiki/Getting-Started-Tutorial 所以我写了一个小程序:
#include <iostream>
#include <http_client.h>
#include <filestream.h>
int main(int argc, const char * argv[]) {
return 0;
}
但是当我尝试运行该程序时,我得到一个"词法或预处理器问题"pplx/pplxtasks.h
指出http_client
中找不到该文件。我缺少一个步骤吗?
我使用brew install cpprestsdk
安装
您需要将额外的标题搜索路径设置为/usr/local/include
。会发现cpprestsdk
和pplx
都是彼此的对等体。然后使用这个:
#include <cpprest/http_client.h>
然后,您将遇到致命错误:"未找到openssl/conf.h"文件 请参阅 https://github.com/Microsoft/cpprestsdk/issues/458
。导致需要具有如下所示的标题搜索路径:/usr/local/include; /usr/local/opt/openssl/include
和库搜索路径,如下所示:/usr/local/opt/cpprestsdk/lib; /usr/local/opt/openssl/lib; /usr/local/opt/boost/lib
和额外的链接器标志,如下所示:-lcpprest -lssl -lcrypto -lboost_system -lboost_thread-mt -lboost_chrono-mt
- 将项目添加到队列时运行线程
- 如何使用矢量元素将项目添加到结构中?
- 本机 Nuget 包安装在 VS 中,但没有为C++(本机)项目添加引用
- 如何将多个 QStringList 中的项目添加到一个
- CMake 和/或在为项目添加提升时出错
- 我无法将项目添加到 ( 标准::矢量 < 标准::矢量 <标准::字符串> > )
- 计数器将项目添加到数组中,并剩余
- 将CMAKE项目添加到Visual Studio解决方案中
- 如何使用QListView项目添加复选框
- C++将项目添加到集合中
- 在MFC中的树(ctreectrl)中的特定树项目添加图标
- 如何将类的项目添加到C 的数组中,而无需给它们命名
- 如何将项目添加到输出文件中
- CMAKE将新项目添加到解决方案中
- 如何将项目添加到QT中的布局中
- 将项目添加到双向链表的背面时遇到问题
- 捕获非默认文件夹上的项目添加事件
- wxWidgets-通过DLL将项目添加到sizer
- 使用.push_back将新创建的项目添加到库存
- 如何将MFC应用程序项目添加到Visual C 2008中的Win32应用程序项目