Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

Thank You, Vish

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.