Menu

missing sys/io.h header file

2009-11-10
2012-09-26
  • Martin Hurst

    Martin Hurst - 2009-11-10

    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.

     
  • cpns

    cpns - 2009-11-10

    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.

     
  • cpns

    cpns - 2009-11-10

    ... 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

    Where can I find this header file?

    In future, look in the include directories of your compiler!

     
  • cpns

    cpns - 2009-11-10

    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!

     
  • Martin Hurst

    Martin Hurst - 2009-11-10

    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.

     
  • cpns

    cpns - 2009-11-10

    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

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.