View Single Post
  #1   (View Single Post)  
Old 15th July 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Default What include and shared library directories are searched by gcc

Hello I have a question concerning gcc with f2c files and where gcc looks for include and shared library directories. Perhaps this should be in the programming section but since the problem only occurs in freebsd and I did not intend to do programming, I hope that I can ask it here.
The problem is that I want to compile foo.c which is the output from f2c program. The makefile make.sh is as follows
Code:
 gcc -03 -o oscillator oscillator.c -lf2c -lm
but gcc complains that it cannot find the f2c.h so I look up where f2c.h is
Code:
 /usr/local/inclucde
and change the make file to
Code:
 gcc -03 -o oscillator oscillator.c -I/usr/local/include -lf2c -lm
then in complains that it cannot find lf2c so I check with
Code:
 ldconfig -r | grep lf2c
and I get
Code:
 531:-lf2c.2 => /usr/local/lib/libf2c.so.2
and I change the makefile to
Code:
gcc -03 -o oscillator oscillator.c -I/usr/local/include -L/usr/local/lib -lf2c -lm
and now it compiles.
So my question are
1)why gcc does not look in the /usr/local for include files and why if ldconfig had lf2c linked why did gcc not find the file.
2) how can I change so that gcc looks for include and library files in /usr/local
3) Is the gcc in /usr/bin the same as /usr/local/gccXX, what I can see it is not a link
Reply With Quote