Linking .a library file
Dear sir,
I am trying to use the NIST Fingerprint Qaulity library in my c code i have written code like, Code:
#include <stdio.h> i have tried like this in my Makefile Code:
g++ -o quality quality.c -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image Code:
:~/quality_separate$ make where i am making mistake please let me know and help me to solve the issue Thanks & Regards rohaan |
Header files are typically used for declaring functions, however, and again typically, the implementation for such functions is done within the library file.
You indicated that you are using a static library 'libnfiq.a' and 'libimage.a'. You should check each of these to ensure that the unreferenced functions are indeed present. For example: Code:
$ nm libnfiq.a | grep comp_nfiq |
you have missed some -I <path/to/include/files> flags
|
Quote:
i tried your suggested things i thing the libraries got the function i am trying to use as the out of above commands are Code:
ivb@ivb-desktop:~/quality_separate$ nm libnfiq.a | grep comp_nfiq Rohaan |
Quote:
Can you please let me know briefly so that i can learn from this mistake where i am going wrong my library are present at the /home/ivb/quality_separate so i used -L symbol to get to the directory and then used the -l to link respective library. and header files are included in C code Itself. If possble Can you please help regarding this Code:
-L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image rohaan |
to compile something.c you need header files, you specify the location of headers by -I <path>. you will specify the name of the required headers in the source files by #include <filename> lines.
lo link several object files into an app you may need libraries, and you need to specify the location of those libs by -L <path>. you will specify the name of the required libs by -l <name-of-the-lib> Code:
# so step one: (you need not use -I, -L and -l for default headers and libs) |
Quote:
Thanks for such clean reply i got your point. i think we might need to give the path of the Header files -I<Path> when we are not using the defualt header files i tried your suggestions so my make file look like Code:
all: Code:
$ make rohaan |
so first step works, you have got an error during the second step. It means you have a missing lib from that command.
do you have both libimage.so and libimage.a? Do you haev both libnfiq.so and libnfiq.a? |
Quote:
Regards rohaan |
please compile with g++ -g .... (so add -g to both lines) and post the result.
also can you try gcc intead of g++ (that means gcc -o .....) thanks |
Quote:
results Code:
$ make Code:
# step one: rohaan |
-g is used to keep debug info. You can see the differences - without -g:
quality.c:(.text+0x6c): undefined reference to `read_and_decode_grayscale_image(char*, int*, unsigned char**, int*, int*, int*, int*, int*) with -g: /home/ivb/quality_separate/quality.c:55: undefined reference to `read_and_decode_grayscale_image(char*, int*, unsigned char**, int*, int*, int*, int*, int*)' So the first step is ok again, in the second step you got another errors, the previous errors were not displayed. I think you need to add more libs with -l. What kind of libs do you have next to libimage? (please try to use gcc -g ...) |
Quote:
Ok i will there some more lib i dont think these are relevent but i will try and link and compile as i want to use it as app one technical doubt, i am doing this to add two lib Code:
g++ -o quality quality.o -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image Code:
g++ -o quality quality.o -L /home/ivb/quality_separate -l nfiq -l image -l lib3 -lib4 |
-L /home/ivb/quality_separate (or any other dir) should be specified only once.
|
Quote:
This time i linked all the lib i have from the NIST site for running the quality code i did through terminal and got simillar result like, Code:
$ gcc -o quality quality.o -L /home/ivb/quality_separate/ -l nfiq -l image -l cblas -l fet -l jpegl -l pca -l png -l z -l clapck -l fft -l ioutil -l mindtct -l nfseg -l pcautil -l util -l bozorth3 -l f2c -l ihead -l jpegb -l mlp -l openjpeg -l pcax -l wsq rohaan |
All times are GMT -5. The time now is 11:21 PM. |