"#include <asm / io.h>" causes "error: asm / io.h: There is no such file or directory"
I am using gentoo and trying to compile a program for controlling bits on a parallel port. He has this line near the top:
#include <asm/io.h> And when I try to use gcc on it, it produces this output:
port.c: 4: 20: error: asm / io.h: no such file or directory
"find asm / io.h" yeilds (by the way):
/usr/src/linux-2.6.32-gentoo/arch/x86/include/asm/io.h
So, I have a header file, but it does not find it? Why is this not working?
I'm not sure if you are the author of the program, or just trying to compile a program that you received from someone, but it looks like #include <asm/io.h> should be replaced by #include <sys/io.h> . See the results of this google search for more information.
Never use the code / headers in /usr/include/asm . Use the /usr/include/sys headers instead.
What you do using /usr/include/asm/ creates your code against a specific revision of the kernel headers. This can lead to breakage when changing kernel headers. When linking to another location, you will refer to a more stable form of headers in glibc, which will refer to kernel headers as needed. That's why a large array of #ifdef ... #endif strings #ifdef ... #endif sliced ββeverything in the headers.
Believe me, all the tools needed to use parallel ports in parallel will be in /usr/include/sys/io.h , since probably all you are going to use are direct calls to readb() and writeb() for the corresponding /dev/lpX .
You may need to add a path. At the gcc command prompt:
gcc -I/usr/src/linux-2.6.32-gentoo/arch/x86/include ... to try
gcc -I/usr/src/linux-2.6.32-gentoo/arch/x86/include xyx where xyz is the file you are trying to compile.
This tells the compiler where to look for included files. You can have many -I options if your include files are in different places, like
gcc -I/usr/src/linux-2.6.32-gentoo/arch/x86/include -I/usr/src/some/Dir xyx Add -I / usr / src / linux-2.6.32-gentoo / arch / x86 / to include in your compiled command line.