Compiling with CLion and libpqxx

我只是一个虾纸丫 提交于 2020-04-16 06:20:55

问题


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.

  1. 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.
  2. 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.
  3. Do I have to add some setting in CLion to build my project with C++11?

来源:https://stackoverflow.com/questions/50800151/compiling-with-clion-and-libpqxx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!