1

I am trying to run OpenALPR on QT. I installed it here. I can test it from terminal successfully. I got the error in the title on QT. Undefined reference error is caused by unlinked library but I add the libopenalpr.so under the path /usr/lib to the .pro file. Why I get that error?

My cpp file:

#include "alpr.h"
int main()
{
    alpr::Alpr openalpr("us", "etc/openalpr/openalpr.conf");
}

My pro file:

QT += core
QT -= gui
TARGET = OpenAlprTry
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
LIBS += -L -lopenalpr
ffttyy
  • 853
  • 2
  • 19
  • 49
  • You add the libopenalpr in the progile with -lopenalpr true. However, the -L option (which is used to indicate the path to the library) has no parameter. You should do something like -L /usr/lib -lopenalpr. – Gabrielle de Grimouard Aug 07 '17 at 07:23

2 Answers2

3

You can use pkg-config to link with your wanted library. Add to .pro file:

unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += openalpr

Package name could be different or you could need to add more packages.

To check pkg-config names type in your terminal:

pkg-config --list-all | grep openalpr

and add packages like that

unix: PKGCONFIG += package1 package2 package3
Eligijus Pupeikis
  • 1,115
  • 8
  • 19
0

Can you first check whether openalpr library is in the library path? IF not add the library path to the .pro file.

Som
  • 185
  • 15