Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"#include <asm/io.h>" causes "error: asm/io.h: No such file or directory"

I am using gentoo and trying to compile a program to control the bits on the parallel port. It has this line near the top of it:

#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

"locate asm/io.h" yeilds (among other things):

/usr/src/linux-2.6.32-gentoo/arch/x86/include/asm/io.h

So I have the header file, but it's not finding it? Why is this not working?

like image 956
marcusw Avatar asked Dec 23 '09 15:12

marcusw


People also ask

What do 2 quotation marks mean?

Use double quotation marks (“”) around a direct quote. A direct quote is a word- for-word report of what someone else said or wrote. You use the exact words and punctuation of the original. Harriet Jacobs writes, “She sat down, quivering in every limb” (61).

What is quotation mark used for?

The primary function of quotation marks is to set off and represent exact language (either spoken or written) that has come from somebody else. The quotation mark is also used to designate speech acts in fiction and sometimes poetry.

What is double quotation called?

Quotation marks can be double ("...") or single ('...') - that is really a matter of style (but see below for more about this). Quotation marks are also called "quotes" or "inverted commas".

What is the difference between 1 and 2 quotation marks?

General Usage Rules In America, Canada, Australia and New Zealand, the general rule is that double quotes are used to denote direct speech. Single quotes are used to enclose a quote within a quote, a quote within a headline, or a title within a quote.


2 Answers

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

like image 87
Alok Singhal Avatar answered Sep 29 '22 12:09

Alok Singhal


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

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

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

like image 42
Kumba Avatar answered Sep 29 '22 10:09

Kumba