On Thu, May 30, 2002 at 01:53:19PM +0100, Wei Wang wrote:
> Thanks a lot.
>
>
> It works:
>
> gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../src/interfaces/libpq -I../../../src/include
-Wl,-rpath,/local/scratch-1/ww220/postgresql-7.1.3/lib -L/homes/ww220/myspace/postgresql-7.1.3/lib testlibpq.c -o
testlibpq-lpq
> testlibpq.c: In function `exit_nicely':
> testlibpq.c:14: warning: implicit declaration of function `exit'
>
> I am a total newbie to almost everything. I put
> export PATH=/local/scratch-1/ww220/myspace/postgresql-7.1.3/lib:$PATH
> in .bash_profile and did ". .bash_profile". Is that different from putting
> -L switch in gcc command?
The PATH variable list directories to look for *programs*. So that's
different. -L tells the compiler where to look for libraries while linking.
And if you add that directory to /etc/ld.so.conf (if supported by your
dynamic linker) then you don't need the -rpath bit either.
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Canada, Mexico, and Australia form the Axis of Nations That
> Are Actually Quite Nice But Secretly Have Nasty Thoughts About America