Skip to content

Minimal example fails to build in Visual Studio 2022 on Windows #1833

@symbolix

Description

@symbolix

Minimal example:

#include <iostream>
#include <cpprest/http_client.h>
#include <cpprest/ws_client.h>

int main()
{
    std::cout << "Hello World!\n";
    web::http::client::http_client httpClient(U("http://localhost"));
    web::websockets::client::websocket_client wsClient;
    (void)httpClient;
    (void)wsClient;
    return 0;
}

Error:

Build started at 20:01...
1>------ Build started: Project: restaurant-data-app, Configuration: Release x64 ------
1>restaurant-data-app.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl web::websockets::client::details::websocket_client_task_impl::websocket_client_task_impl(class web::websockets::client::websocket_client_config)" (__imp_??0websocket_client_task_impl@details@client@websockets@web@@QEAA@Vwebsocket_client_config@234@@Z)
1>C:\Users\me\dev\restaurant-data-app\x64\Release\restaurant-data-app.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "restaurant-data-app.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 20:01 and took 00.577 seconds ==========

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions