0

Postgresql through c++ and libpqx USING VISUAL STUDIO 2022

** I Dont know much about source files.but I do know that I installed libqxx and vcpkg along with postgesql I configured and generated using cmake.right now im trying to run/build this code from the pqxx tutorial:

#pragma once

#include <string>
#include <iostream>
#include <pqxx/pqxx>

int main()
{
    std::string connectionString = "host=localhost port=5432 dbname=test user=postgres password =123454321";

    try
    {
        pqxx::connection connectionObject(connectionString.c_str());

        pqxx::work worker(connectionObject);

        pqxx::result response = worker.exec("SELECT * FROM users");

        for (size_t i = 0; i < response.size(); i++)
        {
            std::cout << "Id: " << response[i][0] << " Username: " << response[i][1] << " Password: " << response[i][2] << " Email: " << response[i][3] << std::endl;
        }
    }
    catch (const std::exception& e
)
    {
        std::cerr << e.what() << std::endl;
    }

    system("pause");
}

When I run this code I get a linker error LNK 2019 unresolved symbols public private and protected.i did set paths in properties, I did a lot so was wondering if anyone could help please **

0 Answers0