Hi I have written a function nabs in assembly file math.nasm as follows
%ifdef USE_x86_ASM
SECTION .text
cglobal nABS
;*------------------------*
;* int nABS(int a) *
;* return value in eax *
;*------------------------*
ALIGN 16
nABS:
push ebx
......
......
pop ebx
ret
%endif
I am calling this function from c function func1 in file myfunc.c
I am using nasm assembler for assembly file I am using X-code 3.1 version and gcc 4.0 compiler I have defined USE_x86_ASM
in Xcode settings Project Settings/Build/NASM BUILD OPTIONs/OTHER FLAGS AS -DUSE_X86_ASM
Also I have defined this pre-processor in header file myfunc.h also
I have declared nABS in myfunc.h as
#define USE_x86_ASM
int nABS(int a);
and included myfunc.h in myfunc.c
Both myfunc.c and math.nasm are compiled sussessfuly and generate math.o and myfunc.o, but I get a linking error
Undefined symbols:
"_nABS", referenced from:
_func1 in myFunc.o
can anyone tell me why am I getting link error?