How are .so files used in Ubuntu

I am very new to Linux and Ubuntu and I have ported my simple game engine to linux. The engine is in a .so file and is linked to the executable.

I am unable to run my executable because it says that it cannot find the Engine.so file (when run in terminal).

So if I am developing on Ubuntu how can I get the executable to find the library were ever it is?

Second question is when distributing the application how are the .so files installed? I assume they are not just put in the same directory as the exe as in windows? so how are they installed?


Executables search for libraries in a set of places, e.g. /lib, /usr/lib, /usr/local/lib,... so if you do not put your .so file in one of these places (/usr/local/lib might be a good place), the executable won't run.

You can explicitly specify a set directories to search for by setting an environment variable LD_LIBRARY_PATH containing whatever directories you like, (including your development directory for instance).