[ACCEPTED]-#include <asm/io.h>" causes "error: asm/io.h: No such file or directory-parallel-port

Accepted answer
Score: 12

I am not sure if you are the author of the 4 program or you're just trying to compile 3 a program you got from someone, but looks like #include <asm/io.h> should 2 be replaced with #include <sys/io.h>. See the results of this google search for 1 more information.

Score: 4

Never use the code/headers in /usr/include/asm. Use the headers 14 in /usr/include/sys instead.

What you are doing by using 13 /usr/include/asm/ is building your code against a specific 12 revision of the Kernel headers. This is 11 subject to breakage when the kernel headers 10 change. By linking to the other location, you 9 will link to a more stable form of the headers 8 in glibc, which will refer to the kernel 7 headers as needed. That's why there's a 6 large complex of #ifdef ... #endif lines peppered all in 5 the headers.

Trust me, all the tools you 4 need for bit-fiddling with the parallel 3 ports will be in /usr/include/sys/io.h, since probably all you're 2 going to be using are direct readb() and writeb() calls 1 to the appropriate /dev/lpX device.

Score: 0

You may need to add the path. On the gcc 1 command line:

gcc -I/usr/src/linux-2.6.32-gentoo/arch/x86/include ...
Score: 0

try

gcc -I/usr/src/linux-2.6.32-gentoo/arch/x86/include xyx

where xyz is the file you're trying to 4 compile.

This tells the compiler where 3 to look for include files. You can have 2 many -I options if your include files are 1 in different locations, like this

gcc -I/usr/src/linux-2.6.32-gentoo/arch/x86/include -I/usr/src/some/Dir xyx
Score: 0

Add -I/usr/src/linux-2.6.32-gentoo/arch/x86/include 1 to your compile command line.

Score: 0

This answer maybe not for your condition, but 3 I hope it can help others.

For me, when I 2 try to make my driver, I met same problem, at 1 last, I fixed it by correct my Makefile from:

obj-m += t.o
KDIR:=/lib/modules/$(shell uname -r)/build
MAKE:=make


t-objs:  main.o base.o

default:
    $(MAKE) -C $(KDIR) M=$(PWD) modules  
clean:  
    $(MAKE) -C $(KDIR) M=$(PWD) clean 

to

obj-m += t.o
KDIR:=/lib/modules/$(shell uname -r)/build
MAKE:=make


t-objs:=  main.o base.o

default:
    $(MAKE) -C $(KDIR) M=$(PWD) modules  
clean:  
    $(MAKE) -C $(KDIR) M=$(PWD) clean 

More Related questions