I am compiling the following code and get the below errors:
This is really confusing me on how to fix it, because I don't see any errors highlighted in Visual Studio, and I have researched/followed the documentation.
I tried reading the linker documentation, but it just doesn't make sense in my context. I have also tried making sure all correct parameters are passed:
#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;
}