On Sat, Mar 16, 2013 at 11:40 AM, Peng Yu <pengyu...@gmail.com> wrote:

> Hi,
>
> g++ does not search /opt/local/lib/ by default. Does anybody know how
> to let it search /opt/local/lib/ by default?
>
> ~/linux/test/cpp/library/pcrecpp$ port select gcc
> Available versions for gcc:
>         apple-gcc42 (active)
>         llvm-gcc42
>         mp-gcc45
>         mp-gcc47
>         none
> ~/linux/test/cpp/library/pcrecpp$ g++ main.o -lpcrecpp  -o main
> -L/opt/local/lib/
> ~/linux/test/cpp/library/pcrecpp$ g++ main.o -lpcrecpp  -o main
> ld: library not found for -lpcrecpp
> collect2: ld returned 1 exit status
>

You should activate one of the MacPorts compilers instead of the apple
version.  mp-gcc47 and mp-gcc45 should automatically search in
/opt/local/lib for libraries.

Alternatively, you can add /opt/local/lib to LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/opt/local/lib:$LD_LIBRARY_PATH
g++ main.o -lpcrecpp -o main

Good luck,
Jason

-- 
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
352-392-4032
_______________________________________________
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users

Reply via email to