LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-07-2006, 09:08 PM   #1
ashlesha
Member
 
Registered: May 2005
Location: PA
Distribution: Ubuntu
Posts: 204

Rep: Reputation: 30
Unhappy Undefined reference to:


Hi,

I m trying to compile the linux kernel 2.6.14.6 with board support for the MIPS EncoreM3 board (AU1500 chip).

I have an irq.c function in the arch/mips/au1000/encm3/ directory and in another file, board_setup.c, in the same directory i make the following assignment:

Quote:
board_init_irq=encm3_board_init_irq;
I get this error when I try to compile

Quote:
arch/mips/au1000/encm3/lib.a(board_setup.o)(.init.text+0x4c): In function `board_setup':
: undefined reference to `encm3_board_init_irq'
arch/mips/au1000/encm3/lib.a(board_setup.o)(.init.text+0x50): In function `board_setup':
: undefined reference to `encm3_board_init_irq'
make[1]: *** [.tmp_vmlinux1] Error 1
make[1]: Leaving directory `/home/ashlesha/KNP-Linux/linux'
make: *** [build] Error 2
Can someone help me out here?

Thanks,
Ashlesha.
 
Old 11-07-2006, 09:20 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
where IS 'encm3_board_init_irq' declared/defined? does the compiler 'know' where it is in this program?
 
Old 11-07-2006, 09:23 PM   #3
ashlesha
Member
 
Registered: May 2005
Location: PA
Distribution: Ubuntu
Posts: 204

Original Poster
Rep: Reputation: 30
encm3_board_init_irq is defined in the irq.c file in the arch/mips/au1000/encm3/ directory and how do i knw if the compiler knows where the program is?

i think the board_setup.c file is being compiled before the irq.c file which is why the compiler cant find the encm3_board_irq_init function..

Thanks,
Ashlesha.
 
Old 11-07-2006, 09:26 PM   #4
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
is there a header you need to include? like irq.h?
 
Old 11-08-2006, 09:10 AM   #5
orgcandman
Member
 
Registered: May 2002
Location: new hampshire
Distribution: Fedora, RHEL
Posts: 600

Rep: Reputation: 110Reputation: 110
the issue boils down to the linker being unable to resolve that particular dependancy.

When the linker starts putting your object files together, its going to look up any undefined symbols, and symbols which are duplicately defined or redefined, and attempt to resolve those issues. If it can't find a symbol, that means you're not linking the definition of that symbol into the final product.

What you might want to do is expose some API to an upper layer routine which will have both of these libraries linked into it, and have THAT make the assignment. That's, at least, one way of solving this issue quickly.
 
Old 11-08-2006, 02:07 PM   #6
ashlesha
Member
 
Registered: May 2005
Location: PA
Distribution: Ubuntu
Posts: 204

Original Poster
Rep: Reputation: 30
Hi,

Thanks for your responses -- I did not receive notification of the same so could not respond earlier.

I do include a header irq.h in the board_setup.c file.

Quote:
What you might want to do is expose some API to an upper layer routine which will have both of these libraries linked into it, and have THAT make the assignment. That's, at least, one way of solving this issue quickly.
When you say it has "both libraries linked into it", do you mean
a) a routine which has all the # include files from board_setup.c as well as irq.c?

OR

b) a routine which calls functions from both these files?

Thanks again for your response,
Ashlesha.
 
  


Reply


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 01:15 AM
undefined reference? Sharky01252 Programming 3 11-07-2006 12:36 PM
undefined reference vkmgeek Programming 1 05-11-2006 07:37 AM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 04:01 AM
undefined reference mp4-10 Programming 3 01-25-2005 01:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:37 PM.

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