# problem installing gmp



## jnb (Dec 12, 2010)

hey guys I've just installed gmp 5 via ports but it doesn't work! when I compile a gmp program it complains it can't find gmp.h.

i've even tried passing 
	
	



```
-I/usr/local/include
```
 (where the header actually is) but i still get the error:


```
/usr/bin/ld: cannot find -lgmp
```

Any thoughts on this one? I'm using FreeBSD 8.1-RELEASE-p1. Thanks!


----------



## wblock@ (Dec 12, 2010)

Your error message says it's looking for "-lgmp", so you maybe have an extra "-l"?


----------



## jrm@ (Dec 12, 2010)

Does the following work for you?

```
gcc -Wall -I/usr/local/include -L/usr/local/lib -lgmp test.c
```


----------



## jnb (Dec 12, 2010)

Hey! Thank you all for your quick replies. Yes if I include  


```
-L/usr/local/lib
```

all goes well. But shouldn't these paths be included in gcc's default search paths? if not, how can I include them?

Thanks.


----------



## jrm@ (Dec 12, 2010)

/usr/local/include and /usr/local/lib used to be in gcc's default search paths, but they aren't now for some reason.  Maybe someone knows why?  You can set the environment variables 
	
	



```
C_INCLUDE_PATH
```
 and 
	
	



```
LIBRARY_PATH
```
.


----------



## jrm@ (Dec 12, 2010)

After a little test...  The system gcc looks, by default, in /usr/include and /usr/lib, which makes sense; it's the system compiler.  gcc45, installed from ports, looks, by default, in /usr/local/include and /usr/local/lib.


----------



## jnb (Dec 13, 2010)

Thanks for all your help mingrone! I'll install gcc 4.5 and give it a go!


----------

