Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 -> ->

and the '/usr/local/include' contains


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: 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
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/ file

If you are on Mac, use the equivalent.

share|improve this answer

Your Answer


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.