0

I compiled C in CentOS and face this error:

cc -c -o obj/BT.o BT.c -I./include -I/usr/dialogic/inc cc -o BT obj/BT.o obj/util.o -I./include -I/usr/dialogic/inc -L/usr /dialogic/lib

obj/BT.o: In function 'main':

BT.c:(.text+0x52): undefined reference to `gc_Start'

collect2: ld returned 1 exit status make: *** [BT] Error 1

I already linked to library -L/usr /dialogic/lib but i don't know why it does not link when create binary file Please, any one can suggest me something ?

Community
  • 1
  • 1
songoku1610
  • 1,576
  • 1
  • 13
  • 17
  • 2
    The `-L` option is to tell the linker where to *search* for libraries, it doesn't actually link with any libraries, for that you need the `-l` (lower-case L) option. – Some programmer dude Mar 09 '15 at 08:47
  • 2
    You've only specified a link *path* - you also need to specify the library via `-lname` where `name` signifies `libname.a`. – Paul R Mar 09 '15 at 08:47
  • Thank you for your answer. This is my lib, it's dynamic lib: `libgc.so`, I already used `-llibgc` options, it show error `/usr/bin/ld: cannot find -llibgc`. This is my command: ` cc -o rrbt obj/BT.o obj/util.o -I./include -I/usr/dialogic/inc -L/usr/dialogic/lib -llibgc` – songoku1610 Mar 10 '15 at 01:55
  • I just use `-lgc` it show error: `/usr/bin/ld: skipping incompatible /usr/dialogic/lib/libgc.so when searching for -lgc`. is that by incompatible lib with current gcc? – songoku1610 Mar 10 '15 at 02:50
  • I just fix it. I move code to CentOS 32 bit, it compile fine, may by lib incompatible in CenOS 64 bit. Thank you very much – songoku1610 Mar 10 '15 at 02:55

1 Answers1

-1

check if you had saved your.c file and also check of spelling of the functions' definition and their calls .