cc / gcc cannot find any libraries / header files

I have a problem with my (own) C programs. gcc cannot find any of my header files or libraries.
$ gcc -lcgi -o info.cgi info.c

When I compile I get this error:
Code:
info.c:3:17: error: cgi.h: No such file or directory

(I installed cgilib and cgi.h is in /usr/local/include/)

Then when I manually fix the path then I get a linker error as so:
Code:
/usr/bin/ld: cannot find -lcgi
 
Well I found the solution, but it's still not linking properly :( I get this
Code:
/var/tmp//cc0OSfPg.o(.text+0xae): In function `main':
: undefined reference to `cgi_init'
/var/tmp//cc0OSfPg.o(.text+0xb8): In function `main':
: undefined reference to `cgi_process_form'
/var/tmp//cc0OSfPg.o(.text+0xc2): In function `main':
: undefined reference to `cgi_init_headers'
/var/tmp//cc0OSfPg.o(.text+0x194): In function `main':
: undefined reference to `cgi_param'
 
Add the -L and -l options to gcc to add the right directories. The /usr/local/include/ and /usr/local/lib/ directories aren't included by default.
 
Back
Top