Including a static library
Hi.
I'm trying to add an external library (libmesh) to a project that must be created under Linux environment.
I've downloaded and compiled the library myself, so it's in a not standard location. The location is in
mydir/lib/libmesh.so
while headers are located in
mydir/include
in this directory I've many subfolders (base, geom etc).
The first thing that I'd like to know is how I can include all include subfolders without declare a INCLUDEPATH for everyone, but telling that I want to use all subfolders of mydir/include.
Then, I'd like to know how include the .so file in my project.
I've tried to use
LIBS += $$quote(mydir/lib/libmesh.so)
and
LIBS += -L$$quote(mydir/lib/libmesh.so)
but nothing happens: I got a lot of "undefined reference" errors.
Have you any suggestion?
Re: Including a static library
For include subdirs try with
Code:
SUBPATH = $$system(ls include)
for(d, SUBPATH):INCLUDEPATH += include/$$d
The correct syntax for libraries is
Code:
LIBS += -L$$quote(mydir/lib) -lmesh
Re: Including a static library
Quote:
Originally Posted by
jepessen
Have you any suggestion?
If the library file you wish to link against has a name ending in .so then it is a dynamic library, not a static library which would end in .a. If both dynamic and static versions of the library exists, then the linker will usually take the dynamic library by default.
Re: Including a static library
Thanks for our reply.
I've seen the QMake documentation and I've seen some example. Thanks. I've another problem, but I'll put it in another thread.
Thanks again to everyone.