1

I'm trying to compile a simple demo app:

gcc -Iinstall/include/ -Linstall/lib/ -lucp -lucs ucp_hello_world.c

And getting alot of linkage errors:

/tmp/ccM7lrxs.o: In function `ucp_init':
ucp_hello_world.c:(.text+0x4a9): undefined reference to `ucp_init_version'
/tmp/ccM7lrxs.o: In function `send_handle':
ucp_hello_world.c:(.text+0x4f9): undefined reference to `ucs_status_string'
/tmp/ccM7lrxs.o: In function `failure_handler':
ucp_hello_world.c:(.text+0x550): undefined reference to `ucs_status_string'
...
many more errors...

However when running:

nm install/lib/libucp.a | grep ucp_init_version
nm install/lib/libucs.a | grep ucs_status_string

It seems like the symbols exist:

0000000000000240 T ucp_init_version  

                 U ucs_status_string
                 U ucs_status_string
                 U ucs_status_string
                 U ucs_status_string
0000000000000000 T ucs_status_string

So what am I doing wrong? (Could it be related to the fact that there are libucp.so and libucp.a and libucp.la in the same folder)?

(P.S tried also with -lucp -lucs -lucp -lucs and got the same error)

Thanks in advance

Noa Ezra
  • 69
  • 2
  • Superficially, this looks like an issue with the order you provided the `-l/-L` args - dependencies should be listed **after** the dependents. – Oliver Charlesworth Nov 19 '17 at 10:42
  • Order matters. If source or object file A depends on library B, then A must come before B on the command line. So put all libraries at the end, after the source file. – Some programmer dude Nov 19 '17 at 10:42

0 Answers0