cgcclibm

Getting following error "collect2: ld returned 1 exit status"


I have created a C source file using the modules from other source files. Suppose the created source file is abc.c .Mine C file compiles fine using the following command.

gcc -c  abc.c 

I have compiled each and every source file that are linked to the abc.c .While creating the executable file using the following command:

 gcc abc.o b.o c.o ....strings.o -o abc

It shows the following error, although i have used strings.o for creating executable file:

strings.o: In function `string_IntToString':
strings.c:(.text+0x5d3): undefined reference to `log10'
strings.c:(.text+0x606): undefined reference to `log10'
collect2: ld returned 1 exit status

Could you suggest me what can be the wrong here?


Solution

  • You forgot to link against libm.

    gcc ... -lm ...