-1

I am trying to compile an example from a library. I have Qt installed but I think I have to link it and I don't know how.

This is the error:

g++ face_recognition.cpp -o test

In file included from face_recognition.cpp:29:0:
/usr/local/include/openbr/openbr_plugin.h:22:23: fatal error: QDataStream: No such file or directory
 #include <QDataStream>
                       ^
compilation terminated.
IAmInPLS
  • 4,051
  • 4
  • 24
  • 57

1 Answers1

2

You can't compile a Qt application directly with g++ because the application must first go through Qt's moc compiler.

If you want to build a Qt application from the cmd-line, make sure you define an appropriate .pro file that specifies the Qt modules and other 3rd party headers/libraries you want might to use. For instance:

QT += core widgets

SOURCES += \
    main.cpp

Then invoke qmake on the command line in the same directory as the .pro file to build the appropriate Makefiles, and finally execute make to build the app.

karlphillip
  • 92,053
  • 36
  • 243
  • 426