Hi there,
i'm trying to write an extremely simple program that writes to the parallel port:
Code:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/parport.h>
#include <linux/ppdev.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int addr = 0x378;
int result = ioperm(addr,5,1);
outb(0xff, addr);
return EXIT_SUCCESS;
}
The problem is when i compile it it tells me i have a undefined reference to the outb function. The man pages tell me that i need to include option -O# to compile my program. I use:
Code:
gcc -O2 ./main.c -o main.o -lm
which spits out:
Code:
/tmp/ccW9TX56.o: In function `main':
main.c:(.text+0x31): undefined reference to `outb'
collect2: ld returned 1 exit status
what am i doing wrong, am i missing an include file or something?
thanks