General setup of compiler and pathes

I have a general newbie question about the toolchain:
I have the codesourcery compiler/tools in "/opt/cs" and the kernel source in "/opt/src/2.6-kernel".

How can the compiler can be setup to use the kernel include path instead of that of cs?

Is "gcc -I/opt/src/2.6_kernel/include -o test test.c" doing this? I guess there is something missing.

I try to work with GPIOs but even included gpio.h I get an error message

In function `gpio_request':
test.c:(.text+0x2d4): undefined reference to `omap_request_gpio'

I think, you can create a kernel module and load this module,
or write a Makefile which will compile your test.c externally.