0
I found on github an HTTP/HTTPS library header (https://github.com/yhirose/cpp-httplib), which says it is only necessary to import it into the archive and use it.
I created the code:
#include <iostream>
#include "httplib.h"
#include <Windows.h>
using namespace std;
int main(void)
{
using namespace httplib;
httplib::Client cli("http://127.0.0.1:5000");
cli.Post("/Teste", "variavel=CPPTESTE", "application/x-www-form-urlencoded");
}
But when I compile there are dozens of errors, such as:
C:\Httplibteste\TesteHttpLib\httplib.h|1930|undefined reference to __imp_shutdown
C:\Httplibteste\TesteHttpLib\httplib.h|2020|undefined reference to __imp_ioctlsocket
C:\Httplibteste\TesteHttpLib\httplib.h|2107|undefined reference to __imp_connect
among others. I saw an article that said it was necessary to import libs such as libwsock32.a and libws2_32.a in Linker, but still the error occurs. How can I fix it?
I identified a link with the resolution, there was no need to import the files. a, actually in Linker should have been included the file WS2_32, after inclusion the program ran correctly. Ref.:https://stackoverflow.com/questions/18559028/undefined-reference-to-imp-wsacleanup/18559081
– Arcyde