The title is self explanatory:
It is my understanding that -L . when compiling specifies that the current working directory is added to the list of directories searched by ld to link shared libraries during compilation, and that this is equivalent to setting the Environment variable for default library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/tugdual/Documents/EPFL/gameboy/done/
Yet when executing the command to compile, if we do not set the environment variable, gcc can't seem to find the library, even with the -L . :
- cc -L . unit-test-cpu-dispatch.o alu.o bit.o util.o cpu-registers.o cpu-storage.o component.o bus.o memory.o cpu-alu.o opcode.o error.o -lcs212gbcpuext -lcheck -lm -lrt -pthread -lsubunit -o unit-test-cpu-dispatch
- ./unit-test-cpu-dispatch && true
- ./unit-test-cpu-dispatch: error while loading shared libraries: libcs212gbcpuext.so: cannot open shared object file: No such file or directory
- Makefile:157: recipe for target 'check' failed
- make: *** [check] Error 127
So what is the difference?
Thanks,
Tugdual