most probably, you need (to install) the X header files. In debian-land there are packages with those files typically named the same as the 'wrapped and boxed' program/tool/(w/e) with an extra 'dev' inserted somewhere (ie. 'x' and 'x-dev' or 'libfoo' and 'libfoo-dev').
Second of all, you need to make sure that the header files are findable. A google search on 'gcc environment variables' should point you in the right direction.
Third: any actual example (as opposed to just 'stuff') would probably help (this is more so on general than in this case).
Fourth: I suggest you read http://www.catb.org/~esr/faqs/smart-questions.html
hope this helps,