c++qt-creatorlibpqxx

How to use libpqxx with qt creator


I use Ubuntu 18.04, Qt creator 4.5.2. I added in pro file:

CONFIG += c++1z
QMAKE_CXXFLAGS += -lpq -lpqxx

Still got following error:

 /usr/local/include/pqxx/strconv.hxx:76: error: undefined reference to `pqxx::internal::demangle_type_name[abi:cxx11](char const*)'

Solution

  • -lpq -lpqxx are linker flags. The variable QMAKE_CXXFLAGS specifies compiler flags. Use the proper variable QMAKE_LIBS for specifying linker flags:

    LIBS += -lpq -lpqxx