View Full Version : Adding library with .a extension
ftl_embedded
2nd September 2015, 08:53
Hello Folks,
Can any one tell me on how to add .a library in qt creator.
My actual file name is DCCAPI.a. It is a DC Cheque Scanner. So i want to add this API definations on qt creator.
Kindly give your valuable feedback on the same.
Awaiting response.
Thanks
ElDorado
2nd September 2015, 21:00
1) you'll need g++ compiler set up in qt creator (mingw will do the trick on windows)
2) in your .pro file add:
LIBS += -LPATH/TO/YOUR/LIB/ -llib_name
-L will point to directory where lib is. You can use $$PWD to point to your project directory. See path reference in Qt for other macros.
-l will point to library name.
3) add header reference to your sources.
note: lib name needed, not lib FILE name. That's why you don't have to put .a
ftl_embedded
3rd September 2015, 08:40
I am using Ubuntu 14.04. Compiler is autodetected to g++. LIBS += -L/home/akkie/Desktop/test/ -lDCCAPI added this line in .pro. but it says cannot find -lDCCAPI..Y so?
you mean header reference like this..#include "DCCAPI.a"
Added after 12 minutes:
Also getting following error.
error: stray '`' in program
/ 1385158487 0 0 0 137210 `
^
error: stray '\210' in program
pic_loadscanlines.o/
^
Charvi
3rd September 2015, 09:46
Try doing
LIBS += "<absolute_path_to_.a>"
For example:
LIBS += "C:\Qt\Qt5.4.2\Tools\mingw491_32\i686-w64-mingw32\lib\libwsock32.a"
ftl_embedded
3rd September 2015, 10:03
Getting error of Stray in program as mentioned above.
Is it related to memory?
anda_skoa
3rd September 2015, 11:00
Getting error of Stray in program as mentioned above.
Is it related to memory?
No, that is because you have
#include "DCCAPI.a"
Binaries are not included, only source text is (usually only headers).
Cheers,
_
ftl_embedded
3rd September 2015, 11:04
How do I fix it??
how to add header reference to sources?
anda_skoa
3rd September 2015, 13:30
How do I fix it??
Easy, remove that line.
how to add header reference to sources?
Also easy: include the header or headers of the library.
Cheers,
_
ftl_embedded
4th September 2015, 07:13
Also,
I have raspberry pi 2 1Gb which has arm controller. So when i try to install qt creator, it gives error of cannot execute binary file: Exec format error.
How do i fix this error?
anda_skoa
4th September 2015, 08:49
I have raspberry pi 2 1Gb which has arm controller. So when i try to install qt creator, it gives error of cannot execute binary file: Exec format error.
How do i fix this error?
Did you build the binary with a toolchain for ARM?
If not, doing so will likely fix this.
Cheers,
_
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.