Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-25-2005, 04:55 AM   #1
LQ Newbie
Registered: Jan 2005
Posts: 16

Rep: Reputation: 0
undefined reference


I am writing my project in C language and using gcc.
The code is compiled ok, there are linker errors.
I am trying to use interrupts that's why there is used request_irq function which is in linux/sched.h .
I am using KDEVELOP!!!
Do I need to use some additional library?

The piece of code is:
int xinit_module(void){

int ret;

outb_p(0, SERPORT + 3); // reset DLAB
outb_p(0, SERPORT + 1);

ret = request_irq(4, &handler, SA_INTERRUPT, "/dev/ttyS0", NULL);
if (ret) {
printf ("##### error requesting irq 4: returned %d\n", ret);

outb_p(0, SERPORT + 3);
outb_p(0xC7, SERPORT + 2);
outb_p(0x0B, SERPORT + 4);

// Bit 3 Enable Modem Status Interrupt
// Bit 2 Enable Receiver Line Status Interrupt
outb_p(0x0C, SERPORT + 1);

return 0;

Error from linker is:
comport.o(.text+0x361): In function `xinit_module':
: undefined reference to `request_irq'

I hope someone can help me

Old 01-25-2005, 05:10 AM   #2
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
Are you writing a driver/module?
Old 01-25-2005, 06:41 AM   #3
LQ Newbie
Registered: Jan 2005
Posts: 16

Original Poster
Rep: Reputation: 0
I would like to detect interrupt on serial port and reply with handler function in my project, so I do not know if driver module should be used for this...
Old 01-25-2005, 12:38 PM   #4
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
I think the code your trying to link to is for the internals of the kernel and not for userland programming. What you probably look into is checking stty and the /dev files.

Heres a useful link for you all about serial interfaces Serial HOWTO. I haven't gone through the document myself but it seems to have a lot of the details you will need.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined reference, why? george_mercury Programming 4 05-07-2009 12:15 AM
undefined reference to `XF86VidModeGetModeLine' apokryphos Linux - General 1 08-07-2005 06:40 PM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 03:01 AM
undefined reference to 'request_irq()' deimosSan Programming 2 11-10-2003 08:15 AM
Yet another 'undefined reference' problem faulpelz2 Linux - Software 3 04-04-2003 11:18 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration