learningmonster
learningmonster

Reputation: 1

trying to use pqxx in my project. errors with cmake and also syntax errors in clion

Something very weird is happening.

Steps i have done:

Cloned pqxx.

Ran: ./configure && make && sudo make install

All fine - installed well under /usr/local/include

So i referenced that in my CMakeLists:

target_include_directories(untitled PRIVATE /usr/local/include/)

i can include it in my main.cpp, no problems no far. problems are starting when i try to use code examples or try to build the project with the include only in it. (without example code) in case i add example code it tells me for example for this line of code:

pqxx::connection c{"postgresql://accounting@localhost/company"};

"expected end of declaration"

so clion is expecting

pqxx::connection c; {"postgresql://accounting@localhost/company"}; but wtf is that ?

its not correct code lol

cmake returns me this:

In file included from /usr/local/include/pqxx/errorhandler.hxx:20:

/usr/local/include/pqxx/types.hxx:91:39: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?

using strip_t = std::remove_cv_t<std::remove_reference_t<TYPE>>;

and much more like

/usr/local/include/pqxx/except.hxx:98:11: error: exception specification of overriding function is more lax than base version

virtual ~sql_error() noexcept override;

^

/usr/local/include/pqxx/except.hxx:43:23: note: overridden virtual function is here

struct PQXX_LIBEXPORT failure : std::runtime_error

^

/usr/local/include/pqxx/except.hxx:98:23: error: expected ';' at end of declaration list

virtual ~sql_error() noexcept override;

does someone know the issue here?

CMakeLists.txt:

cmake_minimum_required(VERSION 3.17)

project(untitled)
add_executable(untitled main.cpp)
set(CONFIG c++17)
set(CMAKE_CXX_STANDARD 17)

target_include_directories(untitled PRIVATE /usr/local/include/)

i am using c++17 on m1 ventura

Upvotes: 0

Views: 107

Answers (0)

Related Questions