Problem in referencing the outportb() function In

2019-06-13 19:04发布

问题:

I have a code in which am trying to use outportb(), but while compiling it on MinGw i am getting below error.

C:\Users\A_TOMAR\AppData\Local\Temp\ccYPvctv.o:dsp.c:(.text+0x68): undefined reference to `outportb'
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>

int main(void)
{
  outportb(0x378,0xFF);
  return 0;
} 

I would like to know which header file is having this particular function?

回答1:

  1. Windows doesn't provide access to a hardware. You should use Win32 API calls.
  2. This function is DOS specific and unavailable in Windows

Googling shows that your solution is inpout32.dll (example with weird font color)



回答2:

#include <pc.h>
void outportb(unsigned short _port, unsigned char  _data);


标签: c mingw