Reputation: 372
I have a static library (libdstruct.a
) that I need to link to my code. I have the library in some "lib" folder inside some "src" folder.
I tried all possible ways with Clang and got all sorts of errors, for example:
clang12 --std=c11 -g3 *.c lib/libdstruct.a -o bin/executable -I /usr/include/openssl -lcrypto
secret.c:5:10: fatal error: 'ds_list.h' file not found
#include <ds_list.h>
^~~~~~~~~~~
1 error generated.
GCC surprisingly worked fine:
gcc10 --std=c11 -g3 *.c lib/libdstruct.a -o bin/executable -I /usr/include/openssl -lcrypto
Any clue? I'm running this on FreeBSD 13, using Clang version 12.
Upvotes: 1
Views: 4797
Reputation: 372
Thanks for the comments, I got it working by adding -I /path to the header files. Thanks again and I really appreciate your help.
Upvotes: 1