You don't. The code you are attempting to compile is presumably targeted at an
*nix environment?
Although MinGW/GCC is a Win32 build of GCC, it does not use the GNU C library,
but rather Microsoft's VC++ 6 runtime C libraray (MSVCRT.DLL).
To port the code you need to know what io.h calls teh code is using and
replace them with Win32, MSVC++, or standard library alternatives. Often it
may just require inclusion of an alternative header file, since often
identical or similar calls are available.
If the code is large and unknown to you, the simplest thing to do to identify
what needs porting is to delete or comment out the header file, and then fix
what breaks as a result.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After I demonstrated my own fallibility regarding the forum markdown syntax, I
would have thought you might do better! Here, what you see in the preview pane
is what you get (wysitppiwyg)! The markdown syntax interprets certain ASCII
formatting in 'special' ways. It is supposed to be an improvement on the old
unformatted text forum (and it is), but no one here seems to have understood
it. That said the continuing lack of a post edit feature does not help.
First of all, user level applications in Windows cannot perform direct
hardware I/O so outp() will not work. Equivalents do exist in the MSVCRT
library (, but they are compatible only with Windows 95, and will not work
with later versions of Windows. The reason being that to allow such access
would allow you to access devices managed by Windows' device drivers and
shared by other applications; it could potentially affect the correct
operation of the whole system.
However there are solutions; how well they will work with Vista and Windows 7
I do not know, I have not looked at such things recently. It requires the use
of a device driver that opens up access to the I/O map. The potential to screw
up your system is still there of course, but the printer port is primarily a
'legacy' port, so nothing is likely to be using it. Try for some potential
solutions.
is a Linux API for opening access to a range of I/O ports, you'll need to use
the mechanism provided by whatever I/O driver you get to work; quite probably
it will not have such a mechanism, and will open access to all of them, in
which case you don't need the call.
What you are attempting to do is not trivial, and given Microsoft's penchant
from locking down Windows ever tighter (mostly a good thing), and constantly
changing driver model with each new version (not always a good thing), you
effort may be doomed. Perhaps this code should remain on Linux where it came
from!?
I downloaded and installed, devcpp-4.9.9.2_setup.exe on Windows XP SP3.
I am getting this compiler message:
sys/io.h: No such file or directory.
Where can I find this header file?
Thank you in advance.
You don't. The code you are attempting to compile is presumably targeted at an
*nix environment?
Although MinGW/GCC is a Win32 build of GCC, it does not use the GNU C library,
but rather Microsoft's VC++ 6 runtime C libraray (MSVCRT.DLL).
To port the code you need to know what io.h calls teh code is using and
replace them with Win32, MSVC++, or standard library alternatives. Often it
may just require inclusion of an alternative header file, since often
identical or similar calls are available.
If the code is large and unknown to you, the simplest thing to do to identify
what needs porting is to delete or comment out the header file, and then fix
what breaks as a result.
... additional note:
You could simply try:
include <io.h>
since that is an MSVC++ header, however being non-standard it may not include
identical interfaces to GNU sys/io.h
In future, look in the include directories of your compiler!
Sorry that should be:
You could simply try:
include <io.h>
Caught out by not taking my own advice regarding the new markdown syntax, and
checking the preview!
I used "include io.h" ok.
Now I need to find an equivalents for,
undefined reference to 'outb' and
undefined reference to 'ioperm'
Code snippet: To access the parallel port,
outb (data_1, BASE_ADDRESS);
ioperm (BASE_ADDRESS, 3, 0);
I did a search in the include dir for the string "outb " but could not a
direct equivalent.
Any ideas?
Thanks.
After I demonstrated my own fallibility regarding the forum markdown syntax, I
would have thought you might do better! Here, what you see in the preview pane
is what you get (wysitppiwyg)! The markdown syntax interprets certain ASCII
formatting in 'special' ways. It is supposed to be an improvement on the old
unformatted text forum (and it is), but no one here seems to have understood
it. That said the continuing lack of a post edit feature does not help.
First of all, user level applications in Windows cannot perform direct
hardware I/O so outp() will not work. Equivalents do exist in the MSVCRT
library (, but they are compatible only with Windows 95, and will not work
with later versions of Windows. The reason being that to allow such access
would allow you to access devices managed by Windows' device drivers and
shared by other applications; it could potentially affect the correct
operation of the whole system.
However there are solutions; how well they will work with Vista and Windows 7
I do not know, I have not looked at such things recently. It requires the use
of a device driver that opens up access to the I/O map. The potential to screw
up your system is still there of course, but the printer port is primarily a
'legacy' port, so nothing is likely to be using it. Try for some potential
solutions.
is a Linux API for opening access to a range of I/O ports, you'll need to use
the mechanism provided by whatever I/O driver you get to work; quite probably
it will not have such a mechanism, and will open access to all of them, in
which case you don't need the call.
What you are attempting to do is not trivial, and given Microsoft's penchant
from locking down Windows ever tighter (mostly a good thing), and constantly
changing driver model with each new version (not always a good thing), you
effort may be doomed. Perhaps this code should remain on Linux where it came
from!?
Clifford
: http://msdn.microsoft.com/en-
us/library/733szwah%28VS.71%29.aspx
: http://www.google.co.uk/search?q=windows+port+io
: http://linux.die.net/man/2/ioperm