Re: Linker Problem ("undefined reference to *")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Predrag Stankovic" <pedjasns@xxxxxxxxxxx> writes:

> I inherited a multi file C code, with a task to port to ARM Linux
> platform. After some corrections, all files compile properly but
> linker fails to link with "undefined reference to *" report.
> I checked all files, referenced functions are declared properly, but
> for some reason they are not linked.

We can't help.  The error message

> attempt to open C:/UC/usr/lmain.o(.text+0x78): In function `main':
> /cygdrive/c/Sandbox/uProcessor_V2/main.c:108: undefined reference to
> `init_packet'

says that the function 'main' refers to 'init_packet', and
'init_packet' is not defined anywhere.  You need to find out where it
should be defined, make sure it is not static, and figure out why it
is not on the link command line.

I note this:

UCOMS2.o(.text+0xa70): In function `send_packet(int, unsigned char*)':
/cygdrive/c/Sandbox/uProcessor_V2/UCOMS2.C:309: undefined reference to
`delay_ms(int)'

The presence of the parameter types in the symbol names suggests that
this is C++ code.  So perhaps the problem is that you are mixing C and
C++ code but are not using extern "C" as required.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux