Dragoș
Dragoș

Reputation: 1

C++ and PostgreSQL connecting problem (libpqxx library)

When I try to install PostgreSQL for C++ (libpqxx library) I receive this error:

# cmake ..
-- Building for: Ninja
-- The CXX compiler identification is GNU 13.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/msys2/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find PostgreSQL (missing: PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR)
-- Found PkgConfig: D:/msys2/mingw64/bin/pkg-config.exe (found version "1.9.5")
-- Checking for module 'libpq'
--   Package 'libpq', required by 'virtual:world', not found
CMake Error at D:/msys2/mingw64/share/cmake/Modules/FindPkgConfig.cmake:607 (message):
  A required package was not found
Call Stack (most recent call first):
  D:/msys2/mingw64/share/cmake/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
  cmake/config.cmake:35 (pkg_check_modules)
  CMakeLists.txt:27 (include)

error

I want to say that I'm using MSYS2 MINGW64 to run cmake .. I followed this tutrial https://github.com/zpervan/PostgreSQL_Cpp

I tried to redo the tutorial, but I think I did a mistake when I installed PostgreSQL

Upvotes: 0

Views: 281

Answers (1)

LionsFan4Life
LionsFan4Life

Reputation: 1

I recommend avoiding cmake for this particular library. After integrating into a few applications I ultimately decided to write my own wrapper for libpq.

Nevertheless, if you are using visual studio then I would use vc package manager.

Run as administrator… for good measure:

vcpkg install libqpxx:x64-windows
vcpkg integrate install

Make sure in your solution property settings that you have vcpkg on for all configurations.

Upvotes: 0

Related Questions