# missing headers even they are present



## SIFE (Nov 15, 2009)

Salamo Alikom
when i try a simple program that require headers from /usr/local/include i get error MSGS from compiler :

```
curl.c:13:23: error: curl/curl.h: No such file or directory
curl.c:14:24: error: curl/types.h: No such file or directory
curl.c:15:23: error: curl/easy.h: No such file or directory
curl.c: In function 'main':
curl.c:44: error: 'CURL' undeclared (first use in this function)
curl.c:44: error: (Each undeclared identifier is reported only once
curl.c:44: error: for each function it appears in.)
curl.c:44: error: 'curl' undeclared (first use in this function)
curl.c:45: error: 'CURLcode' undeclared (first use in this function)
curl.c:45: error: expected ';' before 'res'
curl.c:51: error: 'CURL_GLOBAL_DEFAULT' undeclared (first use in this function)
curl.c:60: error: 'CURLOPT_URL' undeclared (first use in this function)
curl.c:63: error: 'CURLOPT_WRITEFUNCTION' undeclared (first use in this function)
curl.c:65: error: 'CURLOPT_WRITEDATA' undeclared (first use in this function)
curl.c:68: error: 'CURLOPT_VERBOSE' undeclared (first use in this function)
curl.c:70: error: 'res' undeclared (first use in this function)
curl.c:75: error: 'CURLE_OK' undeclared (first use in this function)
```
the source is here .
output of :

```
ls /usr/local/include/curl | grep curl
```
is :

```
curl.h
curlbuild.h
curlrules.h
curlver.h
```


----------



## gordon@ (Nov 15, 2009)

I don't believe /usr/local/include is in the default search path for the compiler. Try adding -I/usr/local/include to your CFLAGS.


----------



## graudeejs (Nov 15, 2009)

yup, you need to add -I/usr/local/include


----------



## SIFE (Nov 15, 2009)

i add this to make.conf :

```
CFLAGS="-I/usr/local/include"
```
both with or without double quote but some problem .


----------



## SirDice (Nov 15, 2009)

Add the -l on the cc commandline. The options in /etc/make.conf are only used when you use the (fbsd) make command.


----------



## SIFE (Nov 15, 2009)

mr SirDice 
i am trying to build VirtualBox from source not the ports ,how can i do that ?


----------



## graudeejs (Nov 15, 2009)

Just build from ports!


----------



## SIFE (Nov 15, 2009)

build it from fail and install from packages give me this when i start VirtualBox :

```
VirtualBox: supR3HardenedMainGetTrustedMain: dlopen("/usr/local/lib/virtualbox/VirtualBox.so",) 
failed: /usr/local/lib/virtualbox/VBoxXPCOM.so: Undefined symbol "shmctl"
```


----------



## SirDice (Nov 15, 2009)

What does this have to do with the original question?


----------



## aragon (Nov 16, 2009)

I think the OP is trying to build from source because the port/package version isn't working for him.

SIFE, that shmctl error message looks like it's related to shared memory.  Are you running a custom kernel?  Do you have SYSVSHM, SYSVMSG, and SYSVSEM options compiled in?


----------



## expl (Nov 16, 2009)

SIFE said:
			
		

> Salamo Alikom
> when i try a simple program that require headers from /usr/local/include i get error MSGS from compiler : ...



When you are compiling/linking C/C++ source and you are using 3rd party libs you should use pkg-config to generate needed flags for GCC.

For example in your case:

```
gcc `pkg-config --libs --cflags libcurl` ftpget.c -o ftpget
```


----------



## SIFE (Nov 22, 2009)

@Mr aragon
no i did not ,but when i buildworld for FreeBSD 8.0-RC3 VirtualBox work well exept the module vboxdrv does not load , buildworld fail in 8.0-RC 3.
@Mr expl
i did what you say and it is work fine but can i make gcc search automaticly for 3rd party lib like Mr gordon@ said .


----------



## graudeejs (Nov 22, 2009)

you can:
1) if you use gcc by hand you can simply make alias for gcc
2) write small wrapper script that will call gcc with custom args... and then use that script
3) probably many other methods I didn't think of


----------



## expl (Nov 22, 2009)

SIFE said:
			
		

> @Mr expl
> i did what you say and it is work fine but can i make gcc search automaticly for 3rd party lib like Mr gordon@ said .



No you can not, you need to use tools like autoconf+automake or something more modern like scons to be able to build your larger pieces of source dynamically.


----------

