Re: undefined reference

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

 



Jurgens du Toit <dutoitjj@yahoo.co.uk> writes:

> When I compile my kernel I get the following Error:
>
> drivers/char/char.o: In function `pty_write':
> drivers/char/char.o(.text+0x740e): undefined reference to `mycache'
> make[1]: *** [kallsyms] Error 1
> make[1]: Leaving directory `/home/fievel/src/linux-2.4.19-16mdk'
> make: *** [vmlinux] Error 2
>
> I modified my pty.c with the following lines in the pty_write method, just 
> before the return:
>
> 	#ifdef _TTYS_DEF
> 	printk("Snooping!\n");
> 	ret = mycache(tty, buf, count);	

Where's the mycache function defined?

> 	#endif
>
> and included the ttysnoop.h, which looks like this:
>
> #ifndef _TTYS_DEF
> #define _TTYS_DEF
>
> /*Defines */
> #define DEVICE_NAME	"ttysnoop"
> #define TTYS_MAJOR		240
>
> static int mycache(struct tty_struct * tty, const unsigned char *buf, int 
> count);
>
> #endif
>
> Why is it not working?

One thing is that if you declare mycache static, then it is only
visible in the translation unit (read "file") where it's defined.  So
if you're using mycache outside the file where it's defined, you will
get an undefined reference.

-- 
--Ed L Cashin     PGP public key: http://noserose.net/e/pgp/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux