c - gcc doesn't find header file in static library I made -


i made static library. not have error, library file too. so, tried use library.

gcc -o hash_gen main.c -l../  -lhashbundle 

library file exist in directory ../, library file name libhashbundle.a. so, thought not have problem in command. tried compile gcc, gcc print error.

main.c:4:10: fatal error: 'hash.h' file not found #include "hash.h"           ^ 

i don't understand. made library make, , makefile

all : libhashbundle.a  libhashbundle.a : hash.o         ar rscv libhashbundle.a hash.o  hash.o : src/hash.c         gcc -c src/hash.c  clean:         rm -rf hash.o 

i thought code many times, didn't found error.

and directory tree

tree  makefile libhashbundle.a  |src   |hash.c   |hash.h  |test   |main.c 

so, ask you. how solve problem?

you specified library search path (-l).

if want header search path, need use -i.

gcc -o hash_gen main.c -i.. -l.. -lhashbundle 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -