How to avoid using LD_LIBRARY_PATH when building a SimpleAmqpClient project?

94 Views Asked by At

I have the following in a file test.cpp:

#include <SimpleAmqpClient/SimpleAmqpClient.h>

int main() {
    AmqpClient::Channel::ptr_t connection = AmqpClient::Channel::Create("localhost");
}

I can compile and run it like this without any issues:

$ g++ test.cpp -o test -l SimpleAmqpClient
$ LD_LIBRARY_PATH=/usr/local/lib/i386-linux-gnu/ ./test

But, I would like to do so without having to set LD_LIBRARY_PATH.

I have tried adding -L /usr/local/lib/i386-linux-gnu to no avail:

$ g++ test.cpp -o test -l SimpleAmqpClient -L /usr/local/lib/i386-linux-gnu
$ ./test
./test: error while loading shared libraries: librabbitmq.so.4: cannot open shared object file: No such file or directory

What is a good way to avoid having to set LD_LIBRARY_PATH?

Thanks!

0

There are 0 best solutions below