| View previous topic :: View next topic |
| Author |
Message |
nerdmaster
Joined: Thu Jul 14, 2005 11:18 am Posts: 52
|
Posted: Wed Dec 07, 2005 3:40 pm Post subject: Using extra libraries with a QT based program |
|
|
I was wondering if anyone can advise me about using extra libraries with a qmake based program, since I'm quite new to these aspects of programming (with most of my experience over the past 2 years being based on Java)
I'm writing a C++ based program for a computer vision project. As a result, there are a number of external (static) libraries I need, these are for the image processing and display functions. I am also planning on making the application graphical and have opted to use the QT toolkit, using qmake.
I was wondering, how do I go about importing these libraries? (bearing in mind that I don't have much experience with make) |
|
| Back to top |
|
 |
Nigel LXF regular

Joined: Fri Apr 08, 2005 9:03 pm Posts: 1141 Location: Gloucestershire, UK
|
Posted: Wed Dec 07, 2005 4:37 pm Post subject: RE: Using extra libraries with a QT based program |
|
|
You need to add them to the link statement in your makefile.
To link in a library called libfred.a that exists in directory /home/joe/libs (not part of $LD_LIBRARY_PATH) you would add the following two parameters to your link statement
-L /home/joe/libs -lfred
(-L adds a directory to those that will be searched for libraries, -l links in a library. The "lib" prefix and ".a" (or ".so") suffix is added by the compiler/linker.
To call routines in the library you will have to include the appropriate header file in your C++ source. _________________ Hope this helps,
Nigel. |
|
| Back to top |
|
 |
ChrisCook
Joined: Tue Jan 17, 2006 3:26 am Posts: 1
|
Posted: Tue Jan 17, 2006 3:54 am Post subject: RE: Using extra libraries with a QT based program |
|
|
I do something like this in a project Im working on currently (http://quarkplusplus.sf.net)
In my qmake project file (*.pro) i have
| Code: | INCLUDEPATH += . src /usr/include/python2.4
LIBS += -lpython2.4 |
this lets me do somthing like
| Code: | | #include <Python.h> |
which includes the file Python.h from /usr/include/python2.4/
the final executable file will be linked with the python2.4 library which it finds from the standard library path. if the library is somewhere else like in your home directory, use | Code: | | LIBS += -L/home/joe/libs -lfred | as in Nigel's example. |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|