I am trying to compile an opengl program which results in:error while loading shared libraries: libGLEW.so.1.11: cannot open  shared object file: No such file or directorycompile: g++ -o triangle triangle.cpp LoadShaders.cpp -I/home/mks/myGL/oglpg/include/ -L/home/mks/myGL/oglpg/lib  -L/usr/lib64 -lglut -lGL -lGLU -lGLEWIn /home/mks/myGL/oglpg/lib there are all the libraries: libGLEW.so       libGLEW.so.1.11.0   libGLEW.a    libGLEW.so.1.11  ( I am not superuser , so I installed glew on the above folder )If I do:ldd ./triangle | grep GLEW        libGLEW.so.1.11 => not found--UPDATE ---Compiling:g++ -o triangle triangle.cpp LoadShaders.cpp -I/home/mks/myGL/oglpg/include/ -L/home/mks/myGL/oglpg/lib -L/usr/lib64 -lglut -lGL -lGLU -lGLEWldd ./triangle :linux-vdso.so.1 =>          libglut.so.3 => /usr/lib64/libglut.so.3         libGL.so.1 => /usr/lib64/nvidia/libGL.so.1         libGLU.so.1 => /usr/lib64/libGLU.so.1         libGLEW.so.1.11 => not found        libstdc++.so.6 => /usr/lib64/libstdc++.so.6         libm.so.6 => /lib64/libm.so.6        libgcc_s.so.1 => /lib64/libgcc_s.so.1         libc.so.6 => /lib64/libc.so.6         libXext.so.6 => /usr/lib64/libXext.so.6         libX11.so.6 => /usr/lib64/libX11.so.6        libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1         libXi.so.6 => /usr/lib64/libXi.so.6         libnvidia-tls.so.340.29 => /usr/lib64/nvidia/tls/libnvidia-tls.so.340.29         libnvidia-glcore.so.340.29 => /usr/lib64/nvidia/libnvidia-glcore.so.340.29         libdl.so.2 => /lib64/libdl.so.2         /lib64/ld-linux-x86-64.so.2        libxcb.so.1 => /usr/lib64/libxcb.so.1         libXau.so.6 => /usr/lib64/libXau.so.6 ls -al /home/mks/myGL/oglpg/lib :drwxr-xr-x.  .drwxr-xr-x.  ..-rw-r--r--.  freeglut_static.lib-rw-r--r--.  freeglut_static_vs2010_d.lib-rw-r--r--.  freeglut_static_vs2010.lib-rw-r--r--.  gl3w.c-rw-r--r--.  glew_static_d.lib-rw-r--r--.  glew_static_vs2010_d.lib-rw-r--r--.  glew_static_vs2010.lib-rw-r--r--.  libfreeglut.a-rw-r--r--.  libglew32.a-rw-r--r--.  libGLEW.alrwxrwxrwx.  libGLEW.so -> libGLEW.so.1.11.0lrwxrwxrwx.  libGLEW.so.1.11 -> libGLEW.so.1.11.0-rw-r--r--.  libGLEW.so.1.11.0-rw-r--r--.  LoadShaders.cpp-rw-r--r--.  targa.cpp-rw-r--r--.  vbm.cpp-rw-r--r--.  vermilion32_d.lib-rw-r--r--.  vermilion32.lib-rw-r--r--.  vermilion64_d.lib-rw-r--r--.  vermilion64.libecho $PATH:/usr/local/cuda-6.0/bin:/home/mks/bin:/usr/local/cuda-6.0/bin:/usr/lib64/:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
libGLEW.so.1.11: cannot open shared object file
libraries;dynamic linking
You need to instruct your system where to find dynamic libraries. System-wide directories like /usr/lib are in the default search path for dynamic libraries, but if you want to add custom directories, you need to declare them by listing them in the environment variable LD_LIBRARY_PATH. This is a colon-separated list of directories, like PATH.export LD_LIBRARY_PATH=/home/mks/myGL/oglpg/libPut this line in your ~/.profile or wherever you define environment variables. You can also run it in a shell and it'll apply to all programs started from that shell.Alternatively, when you build a program using the library, register its location on your system.g++ -Wl,-rpath,/home/mks/myGL/oglpg/lib  -L /home/mks/myGL/oglpg/lib -lGLEWThe chapter on shared libraries in the Program Library Howto may be of additional help.