LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2013, 07:29 AM   #1
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Rep: Reputation: Disabled
Question 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>
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>

#include <nfiq/imgtype.h>
#include <nfiq/imgdecod.h>
#include <nfiq/nfiq.h>
#include <nfiq/mlp.h>


typedef struct opt_flags_s {
   int verbose;
   int old_mode;
   int has_attribs;
} OPT_FLAGS;


int main (void)
{

int quality;

// system("./nfiq -v /home/Desktop/2nd.jpg");

   
   int ret;
   char *imgfile = "/home/Desktop/2nd.jpg";
   unsigned char *idata;
   int img_type, ilen, iw, ih, id, ippi;
   int nfiq;
   float conf;
   OPT_FLAGS flags = { 0, 0, 0 };

         /* This routine will automatically detect and load:         */
         /* ANSI/NIST, WSQ, JPEGB, JPEGL, and IHead image formats   */
         if((ret = read_and_decode_grayscale_image(imgfile, &img_type,
                    &idata, &ilen, &iw, &ih, &id, &ippi))) {
            if(ret == -3) /* UNKNOWN_IMG */
               fprintf(stderr, "Hint: Use -raw for raw images\n");
            exit(ret);
         }

      /* Compute the NFIQ value */
      ret = comp_nfiq(&nfiq, &conf, idata, iw, ih, id, ippi, &flags.verbose);
      /* If system error ... */
      if(ret < 0) {
         free(idata);
         exit(ret);
      }

      /* Report results to stdout */
//      if (flags.verbose == 0) {
            printf("%d\n", nfiq);
//      } else if(flags.verbose == 1) {
            printf("%d\t%4.2f\n", nfiq, conf);
//      }

      /* Deallocate image data */
      free(idata);

}
i wanted to link the two libraries libnifq and lib image
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
and i am getting error
Code:
:~/quality_separate$ make
g++ -o quality     quality.c     -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image
quality.c: In function ‘int main()’:
quality.c:40:20: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
/tmp/ccBkn9nJ.o: In function `main':
quality.c:(.text+0x6c): undefined reference to `read_and_decode_grayscale_image(char*, int*, unsigned char**, int*, int*, int*, int*, int*)'
quality.c:(.text+0xf8): undefined reference to `comp_nfiq(int*, float*, unsigned char*, int, int, int, int, int*)'
collect2: ld returned 1 exit status
make: *** [all] Error 1
The API's showing undefined reference in error are present in the above included header files imgtype.h, imgdecod.h, nfiq.h, mlp.h

where i am making mistake please let me know and help me to solve the issue

Thanks & Regards
rohaan

Last edited by rohaanembedded; 09-12-2013 at 07:51 AM.
 
Old 09-12-2013, 09:53 AM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
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

$ nm libimage.a | grep read_and_decode_grayscale_image
 
Old 09-12-2013, 09:58 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
you have missed some -I <path/to/include/files> flags
 
Old 09-13-2013, 12:09 AM   #4
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by dwhitney67 View Post
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

$ nm libimage.a | grep read_and_decode_grayscale_image
Dear sir thanks for reply
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
000006c0 T comp_nfiq
00000000 T comp_nfiq_featvctr
00000350 T comp_nfiq_flex
ivb@ivb-desktop:~/quality_separate$ nm libimage.a | grep read_and_decode_grayscale_image
00000d80 T read_and_decode_grayscale_image
ivb@ivb-desktop:~/quality_separate$
Regards
Rohaan
 
Old 09-13-2013, 12:14 AM   #5
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by pan64 View Post
you have missed some -I <path/to/include/files> flags
Dear sir,

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
Thanking you,
rohaan
 
Old 09-13-2013, 12:25 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
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:
g++ -o quality.o -c quality.c -I <path1> -I<path2> ....
# this will create quality.o
# step two:
g++ -o  quality     quality.o    -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image
# this will create the app quality.

# all the above in one step:
g++ -o quality quality.c -I <path1> -I<path2>  -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image
you have some #includes in your source but the corresponding -I <path> is missing
(you need not use -I, -L and -l for default headers and libs)
 
1 members found this post helpful.
Old 09-13-2013, 01:29 AM   #7
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by pan64 View Post
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:
g++ -o quality.o -c quality.c -I <path1> -I<path2> ....
# this will create quality.o
# step two:
g++ -o  quality     quality.o    -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image
# this will create the app quality.

# all the above in one step:
g++ -o quality quality.c -I <path1> -I<path2>  -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image
you have some #includes in your source but the corresponding -I <path> is missing
(you need not use -I, -L and -l for default headers and libs)
Dear sir,
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:
        # so step one:
        g++ -o quality.o -c quality.c -I /usr/include/nfiq  -I usr/include/nfiq
        
        # this will create quality.o
        # step two:
        g++ -o  quality     quality.o    -L /home/ivb/quality_separate -l nfiq  -L /home/ivb/quality_separate -l image
        # this will create the app quality.

#       all the above in one step:
#       g++ -o quality quality.c  -I /usr/include/nfiq/  -I /usr/include/nfiq/  -L /home/ivb/quality_separate -l nfiq -L /home/ivb/quality_separate -l image

clean:
        rm -f quality.o quality 
help:
        @echo   'make           would compile and create the library and create a link'
        @echo   'make clean     would remove the object file and executables'
but i am still getting the same results

Code:
$ make
# step one:
g++ -o quality.o -c quality.c -I /usr/include/nfiq  -I /usr/include/nfiq
quality.c: In function ‘int main()’:
quality.c:40:20: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
# this will create quality.o
# step two:
g++ -o  quality     quality.o    -L /home/ivb/quality_separate -l nfiq  -L /home/ivb/quality_separate -l image
quality.o: In function `main':
quality.c:(.text+0x6c): undefined reference to `read_and_decode_grayscale_image(char*, int*, unsigned char**, int*, int*, int*, int*, int*)'
quality.c:(.text+0xf8): undefined reference to `comp_nfiq(int*, float*, unsigned char*, int, int, int, int, int*)'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Regards
rohaan

Last edited by rohaanembedded; 09-13-2013 at 01:34 AM.
 
Old 09-13-2013, 02:09 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
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?
 
Old 09-13-2013, 02:16 AM   #9
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by pan64 View Post
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?
No sir i just have libimage.a and libnfiq.a

Regards
rohaan
 
Old 09-13-2013, 02:26 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
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
 
Old 09-13-2013, 02:38 AM   #11
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by pan64 View Post
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
Sir if i use gcc instead of g++ it gives undefined reference to everything I think it doesnt link the library
results
Code:
$ make
# so step one:
gcc  -o quality.o -c quality.c -I /usr/include/nfiq  -I /usr/include/nfiq
# this will create quality.o
# step two:
gcc  -o  quality     quality.o    -L /home/ivb/quality_separate -l nfiq  -L /home/ivb/quality_separate -l image
/home/ivb/quality_separate/libnfiq.a(nfiq.o): In function `comp_nfiq_flex':
nfiq.c:(.text+0x3a4): undefined reference to `lfsparms_V2'
nfiq.c:(.text+0x460): undefined reference to `get_minutiae'
nfiq.c:(.text+0x4d4): undefined reference to `free_minutiae'
nfiq.c:(.text+0x5a0): undefined reference to `free_minutiae'
nfiq.c:(.text+0x644): undefined reference to `runmlp2'
nfiq.c:(.text+0x687): undefined reference to `free_minutiae'
/home/ivb/quality_separate/libnfiq.a(znorm.o): In function `comp_znorm_stats':
znorm.c:(.text+0x116): undefined reference to `ssx_stddev'
/home/ivb/quality_separate/libimage.a(imgdecod.o): In function `ihead_decode_mem':
imgdecod.c:(.text+0x2c): undefined reference to `get_width'
imgdecod.c:(.text+0x38): undefined reference to `get_height'
imgdecod.c:(.text+0x44): undefined reference to `get_depth'
imgdecod.c:(.text+0x50): undefined reference to `get_density'
imgdecod.c:(.text+0x5c): undefined reference to `get_compression'
imgdecod.c:(.text+0x118): undefined reference to `get_complen'
imgdecod.c:(.text+0x1bc): undefined reference to `set_compression'
imgdecod.c:(.text+0x1cc): undefined reference to `set_complen'
imgdecod.c:(.text+0x220): undefined reference to `inv_bytes'
/home/ivb/quality_separate/libimage.a(imgdecod.o): In function `.L26':
imgdecod.c:(.text+0x3a0): undefined reference to `png_decode_mem'
imgdecod.c:(.text+0x3e4): undefined reference to `get_IMG_DAT_image'
imgdecod.c:(.text+0x412): undefined reference to `free_IMG_DAT'
/home/ivb/quality_separate/libimage.a(imgdecod.o): In function `.L25':
imgdecod.c:(.text+0x4d0): undefined reference to `openjpeg2k_decode_mem'
imgdecod.c:(.text+0x514): undefined reference to `get_IMG_DAT_image'
/home/ivb/quality_separate/libimage.a(imgdecod.o): In function `.L23':
imgdecod.c:(.text+0x660): undefined reference to `jpegb_decode_mem'
/home/ivb/quality_separate/libimage.a(imgdecod.o): In function `.L21':
imgdecod.c:(.text+0x708): undefined reference to `wsq_decode_mem'
/home/ivb/quality_separate/libimage.a(imgdecod.o): In function `.L22':
imgdecod.c:(.text+0x7e0): undefined reference to `jpegl_decode_mem'
imgdecod.c:(.text+0x824): undefined reference to `get_IMG_DAT_image'
imgdecod.c:(.text+0x928): undefined reference to `free_IMG_DAT'
/home/ivb/quality_separate/libimage.a(imgdecod.o): In function `read_and_decode_grayscale_image':
imgdecod.c:(.text+0xdd2): undefined reference to `is_ANSI_NIST_file'
imgdecod.c:(.text+0xf27): undefined reference to `read_ANSI_NIST_file'
imgdecod.c:(.text+0xf97): undefined reference to `get_first_grayprint'
imgdecod.c:(.text+0xfb5): undefined reference to `free_ANSI_NIST'
imgdecod.c:(.text+0x1092): undefined reference to `free_ANSI_NIST'
imgdecod.c:(.text+0x10ec): undefined reference to `free_ANSI_NIST'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `.L2':
imgutil.c:(.text+0x34): undefined reference to `fatalerr'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `SizeFromDepth':
imgutil.c:(.text+0x109): undefined reference to `ceil'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `init_image_data':
imgutil.c:(.text+0x1f6): undefined reference to `syserr'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `WordAlignFromDepth':
imgutil.c:(.text+0x231): undefined reference to `ceil'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `allocate_image':
imgutil.c:(.text+0x320): undefined reference to `calloc_uchar'
imgutil.c:(.text+0x3aa): undefined reference to `fatalerr'
imgutil.c:(.text+0x402): undefined reference to `fatalerr'
imgutil.c:(.text+0x45a): undefined reference to `fatalerr'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `mallocate_image':
imgutil.c:(.text+0x500): undefined reference to `malloc_uchar'
imgutil.c:(.text+0x58a): undefined reference to `fatalerr'
imgutil.c:(.text+0x5e2): undefined reference to `fatalerr'
imgutil.c:(.text+0x63a): undefined reference to `fatalerr'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `alloc_short_image':
imgutil.c:(.text+0x6ba): undefined reference to `syserr'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `alloc_char_image':
imgutil.c:(.text+0x73a): undefined reference to `syserr'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `alloc_int_image':
imgutil.c:(.text+0x7aa): undefined reference to `syserr'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `width_16':
imgutil.c:(.text+0x7e9): undefined reference to `ceil'
/home/ivb/quality_separate/libimage.a(imgutil.o): In function `allocate_aligned_image':
imgutil.c:(.text+0x94e): undefined reference to `fatalerr'
imgutil.c:(.text+0x976): undefined reference to `fatalerr'
imgutil.c:(.text+0x9a6): undefined reference to `fatalerr'
imgutil.c:(.text+0x9d2): undefined reference to `syserr'
/home/ivb/quality_separate/libimage.a(imgtype.o): In function `jpeg_type':
imgtype.c:(.text+0x46): undefined reference to `getc_marker_jpegl'
imgtype.c:(.text+0x80): undefined reference to `getc_marker_jpegl'
imgtype.c:(.text+0xb8): undefined reference to `getc_skip_marker_segment'
imgtype.c:(.text+0xd8): undefined reference to `getc_marker_jpegl'
/home/ivb/quality_separate/libimage.a(imgtype.o): In function `image_type':
imgtype.c:(.text+0x220): undefined reference to `getc_ushort'
imgtype.c:(.text+0x32d): undefined reference to `png_sig_cmp'
imgtype.c:(.text+0x38c): undefined reference to `is_ANSI_NIST'
/home/ivb/quality_separate/libimage.a(intrlv.o): In function `compute_component_padding':
intrlv.c:(.text+0xaf): undefined reference to `ceil'
intrlv.c:(.text+0xfa): undefined reference to `ceil'
intrlv.c:(.text+0x147): undefined reference to `ceil'
intrlv.c:(.text+0x195): undefined reference to `ceil'
/home/ivb/quality_separate/libimage.a(intrlv.o): In function `intrlv2not_mem':
intrlv.c:(.text+0x2c2): undefined reference to `ceil'
/home/ivb/quality_separate/libimage.a(intrlv.o):intrlv.c:(.text+0x31f): more undefined references to `ceil' follow
/home/ivb/quality_separate/libimage.a(imageops.o): In function `WordAlignImage':
imageops.c:(.text+0xa3): undefined reference to `malloc_uchar'
/home/ivb/quality_separate/libimage.a(img_io.o): In function `read_raw_from_filesize':
img_io.c:(.text+0x26): undefined reference to `filesize'
/home/ivb/quality_separate/libimage.a(img_io.o): In function `write_raw_or_ihead':
img_io.c:(.text+0x791): undefined reference to `nullihdr'
img_io.c:(.text+0x7a1): undefined reference to `set_id'
img_io.c:(.text+0x7a9): undefined reference to `set_created'
img_io.c:(.text+0x7b9): undefined reference to `set_width'
img_io.c:(.text+0x7c9): undefined reference to `set_height'
img_io.c:(.text+0x7d5): undefined reference to `set_depth'
img_io.c:(.text+0x7e5): undefined reference to `set_density'
img_io.c:(.text+0x7f5): undefined reference to `set_align'
img_io.c:(.text+0x805): undefined reference to `set_compression'
img_io.c:(.text+0x815): undefined reference to `set_complen'
img_io.c:(.text+0x82a): undefined reference to `set_whitepix'
img_io.c:(.text+0x836): undefined reference to `writeihdr'
img_io.c:(.text+0x89c): undefined reference to `set_whitepix'
/home/ivb/quality_separate/libimage.a(readihdr.o): In function `ReadBinaryRaster':
readihdr.c:(.text+0x3a): undefined reference to `readihdr'
readihdr.c:(.text+0x4a): undefined reference to `get_depth'
readihdr.c:(.text+0x73): undefined reference to `fatalerr'
readihdr.c:(.text+0x7b): undefined reference to `get_width'
readihdr.c:(.text+0x86): undefined reference to `get_height'
readihdr.c:(.text+0x94): undefined reference to `get_density'
readihdr.c:(.text+0xa2): undefined reference to `get_compression'
readihdr.c:(.text+0xae): undefined reference to `get_complen'
readihdr.c:(.text+0xf1): undefined reference to `malloc_uchar'
readihdr.c:(.text+0x162): undefined reference to `malloc_uchar'
readihdr.c:(.text+0x1fc): undefined reference to `fatalerr'
readihdr.c:(.text+0x240): undefined reference to `set_compression'
readihdr.c:(.text+0x250): undefined reference to `set_complen'
readihdr.c:(.text+0x2cc): undefined reference to `syserr'
readihdr.c:(.text+0x2e8): undefined reference to `inv_bytes'
/home/ivb/quality_separate/libimage.a(readihdr.o): In function `ReadIheadRaster':
readihdr.c:(.text+0x390): undefined reference to `readihdr'
readihdr.c:(.text+0x3d0): undefined reference to `fatalerr'
readihdr.c:(.text+0x411): undefined reference to `fatalerr'
readihdr.c:(.text+0x44f): undefined reference to `fatalerr'
readihdr.c:(.text+0x490): undefined reference to `fatalerr'
readihdr.c:(.text+0x4d0): undefined reference to `fatalerr'
readihdr.c:(.text+0x51a): undefined reference to `malloc_uchar'
readihdr.c:(.text+0x58a): undefined reference to `fatalerr'
readihdr.c:(.text+0x5da): undefined reference to `malloc_uchar'
readihdr.c:(.text+0x78c): undefined reference to `syserr'
readihdr.c:(.text+0x7a8): undefined reference to `inv_bytes'
collect2: ld returned 1 exit status
make: *** [all] Error 1
and with g++ -g option i get same result

Code:
# step one:
g++ -g -o quality.o -c quality.c -I /usr/include/nfiq  -I /usr/include/nfiq
quality.c: In function ‘int main()’:
quality.c:40:20: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
# this will create quality.o
# step two:
g++ -g -o  quality     quality.o    -L /home/ivb/quality_separate -l nfiq  -L /home/ivb/quality_separate -l image
quality.o: In function `main':
/home/ivb/quality_separate/quality.c:55: undefined reference to `read_and_decode_grayscale_image(char*, int*, unsigned char**, int*, int*, int*, int*, int*)'
/home/ivb/quality_separate/quality.c:64: undefined reference to `comp_nfiq(int*, float*, unsigned char*, int, int, int, int, int*)'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Regards
rohaan
 
Old 09-13-2013, 02:53 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
-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 ...)
 
Old 09-13-2013, 03:03 AM   #13
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by pan64 View Post
-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 ...)
Dear sir,

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
for adding multiple lib do i nedd to give the directory location each and every time for same directory or

Code:
g++ -o  quality     quality.o    -L /home/ivb/quality_separate -l nfiq -l image -l lib3 -lib4
will do??
 
Old 09-13-2013, 03:21 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
-L /home/ivb/quality_separate (or any other dir) should be specified only once.
 
1 members found this post helpful.
Old 09-13-2013, 03:43 AM   #15
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by pan64 View Post
-L /home/ivb/quality_separate (or any other dir) should be specified only once.
Dear sir,

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
quality.o: In function `main':
quality.c:(.text+0x6c): undefined reference to `read_and_decode_grayscale_image(char*, int*, unsigned char**, int*, int*, int*, int*, int*)'
quality.c:(.text+0xf8): undefined reference to `comp_nfiq(int*, float*, unsigned char*, int, int, int, int, int*)'
collect2: ld returned 1 exit status
Regards
rohaan
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linking static library INTO dynamic library miguelg Programming 6 12-10-2012 09:56 AM
linking library in kernel - what might be the calls library should not be using lakshmi00786 Linux - Kernel 2 07-25-2009 01:30 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
Linking with a library stonehurstX11 Linux - Newbie 4 01-04-2006 04:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration