Search code examples
qtqt5ubuntu-14.04libharu

LibHaru Qt 5 cannot find usr/local/lib. File format not recognized


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.


Solution

  • 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?