help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking Error


From: N. Shamsundar
Subject: Re: Linking Error
Date: Tue, 11 Oct 2005 15:55:13 -0500
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

archna.mittal@gmail.com wrote:
Hi,
  I am a new to the makefile world. I am trying to write a makefile
which consists of two files,but at the compilation time it is giving me
linking error. I do have a feeling that it is makefile error.

/******Makefile***********/
LOCAL_OBJS=DecryptApi.o TESTDRV.o

TESTDRV: $(LOCAL_OBJS)
         arm-linux-gcc -o TESTDRV TESTDRV.o DecryptApi.o -L. -lsddklib

TESTDRV.o:TESTDRV.C
        arm-linux-gcc -g -c TESTDRV.C

DecryptApi.o:DecryptApi.C
        arm-linux-gcc -g -c DecryptApi.C
/**********End of Makefile*****************/



After compling I recieve the error:

/***********************************************************/
arm-linux-gcc -o TESTDRV TESTDRV.o DecryptApi.o -L. -lsddklib
TESTDRV.o: In function `main':
/home/amittal/CPRM/TESTDRV.C:51: undefined reference to
`NMSecure::NMSec_init(void)'
/home/amittal/CPRM/TESTDRV.C:60: undefined reference to
`NMSecure::NMSec_deinit(void)'
/home/amittal/CPRM/TESTDRV.C:63: undefined reference to
`NMSecure::NMSec_deinit(void)'
TESTDRV.o: In function `secTest(NMSecure *)':
/home/amittal/CPRM/TESTDRV.C:208: undefined reference to
`NMSecure::NMSec_fopen(char *, unsigned char)'
/home/amittal/CPRM/TESTDRV.C:255: undefined reference to
`NMSecure::NMSec_fread(short, unsigned char *, unsigned short)'
/home/amittal/CPRM/TESTDRV.C:299: undefined reference to
`NMSecure::NMSec_fclose(short)'
collect2: ld returned 1 exit status
make: *** [TESTDRV] Error 1
/**********************************************************/


While all these functions (NMSec_init(void),NMSec_deinit(void)) are
defined in
DecryptApi.C.

Any pointers are highly appreciated.

Thanks in Advance,
Regards,
-Archna

The Unix linker convention is to refer to libxyz.a as "-lxyz". Thus, your makefile should say

          arm-linux-gcc -o TESTDRV TESTDRV.o DecryptApi.o -L. -lsddk

instead of

          arm-linux-gcc -o TESTDRV TESTDRV.o DecryptApi.o -L. -lsddklib

N. Shamsundar
University of Houston


reply via email to

[Prev in Thread] Current Thread [Next in Thread]