[GIS] compiling a c++ program using proj.4

proj

I am real new to C++ and am having trouble compiling a C++ program that uses the proj.4 library. I downloaded and compiled and installed the proj.4 library on my machine. So, the /usr/local/lib'contains

libproj.a  
libproj.la 
libproj.so -> libproj.so.0.6.6  
libproj.so.0 -> libproj.so.0.6.6  
libproj.so.0.6.6  

and the /usr/local/include contains

nad_list.h  
org_proj4_Projections.h  
proj_api.h  
projects.h  

and to compile my program test.c, I am using the following command

g++ -Wall -g first.c -lproj -o test

The compilation goes fine. But when I try to execute the program with ./test I get the error message

./test: error while loading shared libraries: libproj.so.0: cannot open shared object file: No such file or directory

I can't tell what I am missing here. Any help or suggestions here would be very helpful.

Best Answer

If you are on Linux Are you sure your LD_LIBRARY_PATH is set correctly? Alternatively you can edit your /etc/ld.so.conf file

If you are on Mac, use the equivalent.

Related Question