2

I'm new to Qt, and got following error to my C++ project:

fatal error: apr_pools.h: No such file or directory

I installed apr from https://apr.apache.org/compiling_unix.html and compiled it by executing:

 ./configure
 make
 make install

But I have no idea now how to link proper files to my project.

dom0
  • 7,356
  • 3
  • 28
  • 50
Starspire
  • 272
  • 3
  • 15

3 Answers3

2

I solved my problem by adding external library. The result in .pro file is as below:

unix:!macx: LIBS += -L/usr/local/apr/lib/ -lapr-1

INCLUDEPATH += /usr/local/apr/include/apr-1
DEPENDPATH += /usr/local/apr/include/apr-1

But anyway thanks everyone for their time and good intentions :)

Starspire
  • 272
  • 3
  • 15
  • 3
    That is one hell of a relative pathname. Of course probably if you ever move your project to a different place it will stop working. Couldn't you just say `-L/usr/local/apr/lib` as that path is unlikely to change. Another good possibility is `-L$$PWD/../local/apr/lib` and then make sure that you install into a local/ subdir that is parallel to your project folders – Brandin Oct 13 '14 at 19:52
  • @Brandin Yes, u are right. I changed it in my solution. Thank u a lot! Before I just did it by a qt creator which generate such a relative path. – Starspire Oct 14 '14 at 06:14
0

This is not about linking but about preprocessing for now. (the preprocessor = the program or part of the compiler which read all the lines beginning with a '#' and replace macro and insert included headers.) The preprocessor can't find your header

see http://qt-project.org/doc/qt-5/qmake-project-files.html#declaring-other-libraries

you have to add an include path to where your additional headers are.

[EDIT]

But there are no packages in your distribution ?

What is you OS, or linux distribution ?

if you want to install the bins and headers, maybe something like ./configure --prefix=/usr ; sudo make install should be needed or copy the files directly (adapt to your system and for the makefile)

[/EDIT]

hl037_
  • 3,520
  • 1
  • 27
  • 58
0

You must:

  • Specity in your .pro where header files must be searched: something like win32:INCLUDEPATH += "C:/mylibs/extra headers" unix:INCLUDEPATH += "/home/user/extra headers"
  • You must specify which library must to be linked: something like win32:LIBS += /mylibs/lib.so unix:LIBS += c:/mylibs/library
Jepessen
  • 11,744
  • 14
  • 82
  • 149