I'm trying to test a connection to my postgreSQL database. I've installed libpqxx from here The official C++ client API for PostgreSQL.
I'm using the latest version of CLion for my project, GCC 8.1 on Fedora 28 OS. and I'm going to use the C++11 standard. When I try to compile my code I get:
/usr/local/include/pqxx/internal/statement_parameters.hxx:213:13: error: ‘experimental’ in namespace ‘std’ does not name a type
const std::experimental::optional<Arg> &arg)
^~~~~~~~~~~~
/usr/local/include/pqxx/internal/statement_parameters.hxx:213:35: error: expected unqualified-id before ‘<’ token
const std::experimental::optional<Arg> &arg)
^
/usr/local/include/pqxx/internal/statement_parameters.hxx:213:35: error: expected ‘)’ before ‘<’ token
const std::experimental::optional<Arg> &arg)
^
)
/usr/local/include/pqxx/internal/statement_parameters.hxx:212:40: note: to match this ‘(’
template<typename Arg> void add_field(
^
/usr/local/include/pqxx/internal/statement_parameters.hxx:213:35: error: expected initializer before ‘<’ token
const std::experimental::optional<Arg> &arg)
So I think there is something wrong with my libpqxx configuration or my usage of it.
- Do I have to include some Information on pqxx in the CMakeLists.txt or does the usage of
#include <pqxx/pqxx>
is enough? Using the#include <pqxx/pqxx>
doesn't output any unrecognized errors. - Do I have to configure the libpqxx to use C++11 and reinstall it. If yes, what is the right flag to use for setting a specific C++ standard when executing
./configure
? I didn't find any information on that in the official Site and on the internet. - Do I have to add some setting in CLion to build my project with C++11?