I'm new to GNU/Linux (Lubuntu 11.10) and am trying to compile some C source code out of a Linux programming book from 2001. Am somewhat confused about the inclusion of header files in GNU/Linux.
The program is "simplefb.c" from the book Programming Linux Games by John R. Hall et al (2001). I jumped straight to the chapter on console programming with framebuffer but hit this immediate snag. Would just like to make some simple non-GUI (and non-'text') games in C on Linux for fun...
The problem seems to be with a few #includes to header files:
#include <asm/page.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
Trying the code as given in the book:
> cc the_file.c
gives
fatal error: asm/page.h: No such file or directory
compilation terminated.
And indeed it seems that these files live somewhere else (nowadays?) so I tried amending initially just the first #include to:
#include </usr/src/linux-headers-3.0.0-17-generic/include/asm-generic/page.h>
I chose this particular folder of headers (there are several in /usr/src/) because
> uname -r
3.0.0-17-generic
With the amended #include, I then get the compilation error:
In file included from the_file.c
/usr/src/linux-headers-3.0.0-17-generic/include/asm-generic/page.h:96:38: fatal error: asm-
generic/memory_model.h: No such file or directory
compilation terminated.
And looking in that page.h, it specifies include asm-generic/memory_model.h (removed the hashs and 'tags' as this line won't show up here properly otherwise) but this file does exist in the same folder.
So, before I go on a wild-goose-chase (firstly removing the asm-generic/ bit of the previous include and putting it in quotes), what is the correct procedure I should be using here? Is there an obvious right way to get the book source code to compile?
Thank you. Will be most grateful for any help.