Home > other >  QT creator for mac throwing error with some libraries
QT creator for mac throwing error with some libraries

Time:08-26

When loading a qt project in mac, I've got the following errors.

In file included from ../../common/monitoring.cpp:1:
../../common/monitoring.h:3:10: fatal error: 'prometheus/exposer.h' file not found
#include <prometheus/exposer.h>
         ^~~~~~~~~~~~~~~~~~~~~~
modules/ui/common/monitoring.h:3: error: 'prometheus/exposer.h' file not found
In file included from moc_monitoring.cpp:10:
./../../common/monitoring.h:3:10: fatal error: 'prometheus/exposer.h' file not found
#include <prometheus/exposer.h>
         ^~~~~~~~~~~~~~~~~~~~~~
:-1: error: [monitoring.o] Error 1
modules/ui/common/postgre.h:8: error: 'pqxx/pqxx' file not found
In file included from ../../common/postgre.cpp:1:
../../common/postgre.h:8:10: fatal error: 'pqxx/pqxx' file not found
#include <pqxx/pqxx>
         ^~~~~~~~~~~
modules/ui/common/fileio.cpp:3: error: 'jsoncpp/json/json.h' file not found
../../common/fileio.cpp:3:10: fatal error: 'jsoncpp/json/json.h' file not found
#include <jsoncpp/json/json.h>
         ^~~~~~~~~~~~~~~~~~~~~
modules/ui/common/postgre.h:8: error: 'pqxx/pqxx' file not found
In file included from moc_postgre.cpp:10:
./../../common/postgre.h:8:10: fatal error: 'pqxx/pqxx' file not found
#include <pqxx/pqxx>
         ^~~~~~~~~~~

The libraries have been installed via brew.

In the case of prometheus, I've got this on the pro file for the QT project.

INCLUDEPATH  = "/opt/homebrew/Cellar/prometheus-cpp/1.0.1/include/prometheus/"
LIBS  = "/opt/homebrew/Cellar/prometheus-cpp/1.0.1/lib/cmake/prometheus-cpp -lprometheus-cpp-pull -lprometheus-cpp-core"

But it still fails. Even when adding other libraries installed too.

CodePudding user response:

It should be

INCLUDEPATH  = "/opt/homebrew/Cellar/prometheus-cpp/1.0.1/include

Since the subdirectory prometheus is set in #include <prometheus/exposer.h>.

  • Related