c++ - C++ WinHTTP 库生成符号错误
问题描述
我正在编译以下代码并得到以下错误:
这真的让我很困惑如何修复它,因为我没有在 Visual Studio 中看到任何突出显示的错误,而且我已经研究/遵循了文档。
我尝试阅读链接器文档,但它在我的上下文中没有意义。我还尝试确保传递了所有正确的参数:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <windows.h>
#include <WinHttp.h>
int main()
{
HINTERNET hSession = NULL, hConnect = NULL, hRequest = NULL;
hSession = WinHttpOpen(L"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36",
WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
//make the connection request
if (hSession) {
hConnect = WinHttpConnect(hSession, L"http://api", 80, 0);
}
else {
printf("error: %d", GetLastError());
}
// open the request - not connected at this point
hRequest = WinHttpOpenRequest(hConnect, L"GET", NULL, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0);
//
int x;
std::cin >> x;
return 0;
}
解决方案
推荐阅读
- javascript - 动态排序对象数组javascript
- python - UnboundLocalError:分配前引用的局部变量“qn”
- c# - 当我们创建范围工厂?
- python - 在 spaCy 的 Matcher 中使用自定义令牌扩展
- mysql - MySql 加载本地数据是禁用错误,没有使用终端命令
- python - Python中来自不同Pandas Dataframe系列的一系列两个列表的元素乘法
- php - 摆脱链接上的谷歌翻译?
- reactjs - 添加服务器目录如何影响 create-react-app 的构建脚本?
- c++ - 有没有办法跟踪内存泄漏?
- react-native - 无法从“node_modules\react-native-reanimated\src\Animated.js”解析“./useValue”