Author Topic: [Help]error:'outportb' was not declared in this scope...  (Read 4489 times)


  • Guest
[Help]error:'outportb' was not declared in this scope...
« on: January 26, 2011, 10:44:10 am »
Hello all elite CodeBlockers and I got a silly problem ><

I am recently studying C++ with this lovely CodeBlock/MingGW myself and playing around with the watchdog timer register.
Somehow I meet some issue on the outputb, which used to work on my old C compiler.

The problem it shows an error message  >D:\Study\C_C++\CodeBlocks\WDT\main.cpp:13: error: 'outportb' was not declared in this scope

Why is it not in the scope? Following is my code. Hope anyone can help me out here >< 

Maybe I am missing something important here?

#include <stdio.h>
#include <dos.h>
#include <conio.h>

#define SUPERIO_PORT 0x2E
#define WDT_SET   0xF5
#define WDT_VALUE 0xF6

int main()
        //Enter SuperIO Configuration
        outportb(SUPERIO_PORT, 0x87);
        outportb(SUPERIO_PORT, 0x87);

        //Set LDN
        outportb(SUPERIO_PORT+1 ,0x08);

        //Set WDT setting
        outportb(WDT_SET,0x04);       //Use the second to come down
                                      //If choose the Minute, change value to 0x0C

        //Set WDT sec/min
        outportb(WDT_VALUE,0x05);     //Set 5 seconds

        return 0;


Have a great day all!  :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11715
    • Travis build status
Re: [Help]error:'outportb' was not declared in this scope...
« Reply #1 on: January 26, 2011, 10:52:16 am »
Because this is not DOS and you (the programmer) do not have direct access to the hardware.
BTW: this is a compiler/os/kernel question and you should ask somewhere else.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]