undefined reference to a function

R

rockymaxdeemann

HI, ALL
Iam getting a linking error saying "undefined reference to a
function(say fun() ), these are what I've already done :
-- declared fun() as "extern"
-- included the header in all files calling fun()
-- included the header path in the respective "makefiles" calling the
fun()/including the header
file
still Iam getting " ld returned 1 exit status "
Could any one please suggest me where would have I went wrong ??
thnx in advance.
 
C

Chris Dollin

HI, ALL
Iam getting a linking error saying "undefined reference to a
function(say fun() ), these are what I've already done :

Actually off-topic, since implementation-dependant, but:
-- declared fun() as "extern"
-- included the header in all files calling fun()
-- included the header path in the respective "makefiles" calling the
fun()/including the header
file
still Iam getting " ld returned 1 exit status "
Could any one please suggest me where would have I went wrong ??
thnx in advance.

You have to feed `ld` /all/ the object files, including the one
for the code for `fun`.
 
M

Mark McIntyre

On Fri, 29 Jun 2007 07:54:52 -0700, in comp.lang.c ,
HI, ALL
Iam getting a linking error saying "undefined reference to a
function(say fun() ),

This is a FAQ.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top