C executable not finding library after build

44 views Asked by At

I'm getting started with C on a Mac, and I just built a library outside my project and tried to use it. I passed the -I and -L flags in the Makefile and the project built successfully and generated the executable, but when I tried to run it, it's looking for the library in the wrong places.

hello.out is the name of the executable

dyld[78926]: Library not loaded: libmurmurhash.so Referenced from: /Users/xxxxx/code/C_C++/test_project/hello.out Reason: tried: 'libmurmurhash.so' (no such file), '/usr/local/lib/libmurmurhash.so' (no such file), '/usr/lib/libmurmurhash.so' (no such file), '/Users/xxxxx/code/C_C++/test_project/libmurmurhash.so' (no such file), '/usr/local/lib/libmurmurhash.so' (no such file), '/usr/lib/libmurmurhash.so' (no such file)

Are there any other flags I should pass?

When I put the .so file within the project directory, the executable runs without any problems.

Not sure what I missed, I also exported the LD_LIBRARY_PATH to point to the path of the lib.

0

There are 0 answers