phoku
18-11-2003, 00:28
Hallo,
ich kann folgenden Code nicht compilieren
#include <asm/io.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PORT 0x378
unsigned int getBitAtPos(unsigned int k,unsigned int pos)
{ return (k>>pos)& ~(~0<<1); }
main(int argc, char *argv[]) {
int turn = atoi(argv[1]);
int pos = atoi(argv[2]);
unsigned int value, newvalue;
ioperm(PORT,3,1);
value = inb(PORT);
printf("\n current value is %d",value);
switch (turn) {
case 1:
newvalue = (getBitAtPos(value,pos)) ? value : value + (unsigned int)pow(2,pos);
break;
case 0:
newvalue = (getBitAtPos(value,pos)) ? value - (unsigned int)pow(2,pos) : value;
break;
}
outb(newvalue,PORT);
ioperm(0x378,3,0);
}
und bekomme immer folgende Ferhlermeldung:
phoku:/usr/local/bin/led # g++ -o setpin setpin.c
setpin.c: In function `int main(int, char**)':
setpin.c:22: `ioperm' undeclared (first use this function)
setpin.c:22: (Each undeclared identifier is reported only once for each
function it appears in.)
Kann mir jemand nen Tip geben, woran das wohl liegen könnte?
ich kann folgenden Code nicht compilieren
#include <asm/io.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PORT 0x378
unsigned int getBitAtPos(unsigned int k,unsigned int pos)
{ return (k>>pos)& ~(~0<<1); }
main(int argc, char *argv[]) {
int turn = atoi(argv[1]);
int pos = atoi(argv[2]);
unsigned int value, newvalue;
ioperm(PORT,3,1);
value = inb(PORT);
printf("\n current value is %d",value);
switch (turn) {
case 1:
newvalue = (getBitAtPos(value,pos)) ? value : value + (unsigned int)pow(2,pos);
break;
case 0:
newvalue = (getBitAtPos(value,pos)) ? value - (unsigned int)pow(2,pos) : value;
break;
}
outb(newvalue,PORT);
ioperm(0x378,3,0);
}
und bekomme immer folgende Ferhlermeldung:
phoku:/usr/local/bin/led # g++ -o setpin setpin.c
setpin.c: In function `int main(int, char**)':
setpin.c:22: `ioperm' undeclared (first use this function)
setpin.c:22: (Each undeclared identifier is reported only once for each
function it appears in.)
Kann mir jemand nen Tip geben, woran das wohl liegen könnte?