0

I installed libraries from libharu.org accordingly to the instructions on the page (without any errors). Then I tried to run an example in Qt 5. After adding paths to installed directories

INCLUDEPATH +=/usr/local/include
LIBS +=/usr/local/lib -libhpdf

Qt 5 seemed to find them (headers underline disappeared). However, during debug, it shows errors:

cannot find /usr/local/lib: File format not recognized
cannot find -libhpdf

with

LIBS += -L/usr/...

instead gives errors with every libharu header, undefined reference to HPDF_xxx.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
murnko
  • 148
  • 1
  • 10
  • I am not sure; but what about `INCLUDEPATH +=/usr/local/include` and `LIBS +=-L/usr/local/lib -lhpdf` note that I used `-lhpdf` instead of `-libhpdf` and ensure that file `hpdf.a` exists in the mentioned path. – houssam May 20 '15 at 17:35

1 Answers1

2

Use:

INCLUDEPATH +=/usr/local/include
LIBS +=-L/usr/local/lib -lhpdf

Note that I used -lhpdf instead of -libhpdf and ensure that file libhpdf.a exists in the mentioned path.

See this answer: How can I include a needed C library using GCC?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
houssam
  • 1,823
  • 15
  • 27
  • This doesn't explain [the *why*](https://stackoverflow.com/questions/56641768/adding-c-external-library-in-visual-studio-code#comment99890420_56641768). – Peter Mortensen Nov 06 '22 at 02:31