Cannot find Postgres header while working with Wt c++

212 Views Asked by At

I'm currently working on Ubuntu 20.04 and I am building a web application with WebToolkit. I want to use a Postgresql database to store my data. I built Wt from source, following these steps.

Unfortunately, when I include the header file Wt/Dbo/backend/Postgres.h in my code, I get the following error

cannot open source file Wt/Dbo/backend/Postgres.h

Indeed, the directory Wt/Dbo/backend includes only Sqlite3.h and WDboSqlite3DllDefs.h.

How can I solve the problem?

1

There are 1 best solutions below

0
m7913d On

It seems you haven't build the Postres backend while building Wt from source. This may be due one of the following reasons:

  • ENABLE_POSTGRES is not checked while configuring Wt using CMake
  • Some external dependency, i.e. Postgres, is not met. This should be mentioned in the cmake output. It may be necessary to specify the Postgres directory in the POSTGRES_PREFIX variable of CMake.

Note that sqlite3 is the only backend which is supported without external dependencies.

Note that the same procedure should be followed for other database too, such as MySQL (or MariaDB), Firebird, ...