Home > Net >  "unresolved external symbol" when including a single-header library
"unresolved external symbol" when including a single-header library

Time:06-15

When I try to include any single-header library in my project (here I am using 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?

CodePudding user response:

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.

  • Related