0

I am trying to link ICU 57 to my binary file. That does not work even thought (I think at least) I am linking the static lib files. Here is a blunt example:

gcc -static /usr/lib/libicui18n.a /usr/lib/libicuuc.a /usr/lib/libicudata.a /usr/lib/libicule.a /usr/lib/libiculx.a /usr/lib/libicutu.a /usr/lib/libicuuc.a /usr/lib/libicuio.a obj/ex.o obj/msg.o -o bin/ex

This is the error message that I get:

src/msg.c:5: undefined reference to `u_fopen_57'
src/msg.c:9: undefined reference to `u_fgetfile_57'
src/msg.c:10: undefined reference to `u_fgetfile_57'
src/msg.c:11: undefined reference to `u_frewind_57'
src/msg.c:18: undefined reference to `u_fgetc_57'
src/msg.c:17: undefined reference to `u_feof_57'
src/msg.c:25: undefined reference to `u_fclose_57'

Linking the dynamic libs works fine though.

Steven R. Loomis
  • 4,228
  • 28
  • 39
Mihai H
  • 3,291
  • 4
  • 25
  • 34
  • 1
    Possible duplicate of [Why does the order in which libraries are linked sometimes cause errors in GCC?](http://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc) – Mike Kinghan Jun 29 '16 at 15:35

1 Answers1

0

If you can, I'd recommend using pkg-config as I recommended here,

specifically with pkg-config --static … as explained here

Community
  • 1
  • 1
Steven R. Loomis
  • 4,228
  • 28
  • 39