On 1 March 2012 20:22, Marco Ricci wrote: > Thanks to both you and Jonathan Wakely for responding. > >> I guess you checked that with ldd on your program, not >> strace on the build? > > Correct, but I also had some printf statements and so it was clear at run time as well. > >> There are 2 operations called linking. One is when you >> create the binary file. Another one is when you run it. -L >> tells where to look for libraries during the first one. >> -rpath (it is a linker option, so you want -Wl, in front) >> tells where to look during the second one. > > So I should use both -L option and -Wl option while compiling? Yes, -Lxxx -Wl,-rpath,xxx where xxx is the path to the library.