-1

When I try to include any single-header library in my project (here I am using HTTPRequest), it keeps giving me the LNK2019 error. enter image description here

This is my code:

#include "HTTPRequest.hpp"

void main()
{
    http::Request request{ "http://test.com/test" };
    const auto response = request.send("GET");
    std::cout << std::string{ response.body.begin(), response.body.end() } << '\n';
}

Is this an issue with my project setup because these libraries are meant to be a single h/hpp file?

Mlemix
  • 57
  • 1
  • 2
  • 6
  • 2
    Side note: If you switch from the Error List tab to the Output tab (usually found right beside each other) you get a plaintext listing of the build output that's just about perfect for pasting into Stack Overflow. Any time you can avoid having to use an image on Stack Overflow, take it. Text-as-text makes everybody's lives easier. – user4581301 Jun 14 '22 at 20:14

1 Answers1

7

Those error messages are referring to socket API functions which the HTTP library is using. You need to link your project to your platform's socket library, ie ws2_32.lib on Windows, etc.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770