Share

Dev-C++

Subscribe

missing sys/io.h header file

  1. 2009-11-10 03:21:35 UTC

    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.

  2. 2009-11-10 11:37:56 UTC

    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.

  3. 2009-11-10 11:42:12 UTC

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

  4. 2009-11-10 13:03:09 UTC

    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!

  5. 2009-11-10 18:39:07 UTC

    I used "include io.h" ok.

    Now I need to find an equivalents for, [Linker error] undefined reference to 'outb' and [Linker error] undefined reference to 'ioperm'

    Code snippet: To access the parallel port, outb (data1, BASEADDRESS); 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.

  6. 2009-11-10 19:25:36 UTC

    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 (_outp, _outpw, _outpd, 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 this Google search for some potential solutions.

    ioperm() 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

< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.