PDA

View Full Version : C++ Static library Eclipse



AndreiTudor
12th December 2011, 17:25
Hello,

I am trying to include a static library in QT, but it doesn't seem to see my classes.
This is how I included it in the .pro file

LIBS += "../Src/Debug/libSrc.a"
INCLUDEPATH += "../Src/."

The library is in the same workspace as the qt app.

Thanks,
Andrei

Spitfire
13th December 2011, 10:32
Are the paths correct?
If you can't see your classes it means that INCLUDEPATH doesn't point to correct place.
Try using absolute path rather than relative, maybe working directory is something totally different than you think, then relative path will be wrong.

Also I find it odd that your lib name is 'src'... anyway, with libs use -L and -l, plus quotes may mess up things.
INCLUDEPATH += C:\Development\projects\FileIO // correct, absolute path to your headers
LIBS += -L C:\Development\projects\FileIO-build-desktop\debug -l FileIO // correct and absolute path to directory containing your compiled library and that library name as it stands in that library project, not file name.
// the line above points to this file: C:\Development\projects\FileIO-build-desktop\debug\libFileIO.a
ps. use [code] tag in a future.