Linking OS shared libs


Inaki Malerba
 

Hi!

I've been strugling with this for a while and I can't make it work.

I need to link my project to a shared library (libcbor[1]), which is located on /usr/local/include.

Reading the project's Makefiles, i found the variable STDINCLUDE, so i fixed the `fatal error: cbor.h: No such file or directory` adding the following line to the app's Makefile

`export STDINCLUDE = -I/usr/local/include`

But the next problem I got is how to tell the linker to use that lib.

```

src/built-in.o: In function `main':
/somepath/src/main.c:8: undefined reference to `cbor_new_definite_map'
/somepath/src/main.c:11: undefined reference to `cbor_build_string'
/somepath/src/main.c:11: undefined reference to `cbor_move'
/somepath/src/main.c:12: undefined reference to `cbor_build_bool'
/somepath/src/main.c:12: undefined reference to `cbor_move'
/somepath/src/main.c:10: undefined reference to `cbor_map_add'
/somepath/src/main.c:15: undefined reference to `cbor_build_uint8'
/somepath/src/main.c:15: undefined reference to `cbor_move'
/somepath/src/main.c:16: undefined reference to `cbor_build_string'
/somepath/src/main.c:16: undefined reference to `cbor_move'
/somepath/src/main.c:14: undefined reference to `cbor_map_add'
/somepath/src/main.c:21: undefined reference to `cbor_serialize_alloc'
/somepath/src/main.c:24: undefined reference to `free'
/somepath/src/main.c:26: undefined reference to `fflush'
/somepath/src/main.c:27: undefined reference to `cbor_decref'

```

How can I tell the linker to _link_ that lib?

btw, compiling with `cc -lcbor src/main` works.


Thanks !


*[1] PJK/libcbor https://github.com/PJK/libcbor/

-- 
Martin IƱaki Malerba
inakimmalerba@... | +54 02945 15468443
inaki@...

Join users@lists.zephyrproject.org to automatically receive all group messages.