Jump to content

undefined reference to `main' or 'printk' or `__this_module'


Guest dmiller.org
 Share

Recommended Posts

Guest dmiller.org

When compiling my USB driver I got the following error message which I solved with a change to my makefile. I'm using Mandrake Linux 9.1.

 

Error Message:

 

/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2.2/../../../crt1.o(.text+0x18): In function `_start':

: undefined reference to `main'

/tmp/ccdKE6zL.o(.text+0xc): In function `activewire_probe':

/home/david/lib/test/activewire.c:43: undefined reference to `printk'

/tmp/ccdKE6zL.o(.text+0x20): In function `activewire_disconnect':

/home/david/lib/test/activewire.c:50: undefined reference to `printk'

/tmp/ccdKE6zL.o(.text+0x34): In function `activewire_ioctl':

/home/david/lib/test/activewire.c:58: undefined reference to `printk'

/tmp/ccdKE6zL.o(.text+0x48): In function `activewire_init':

/home/david/lib/test/activewire.c:91: undefined reference to `printk'

/tmp/ccdKE6zL.o(.text+0x54):/home/david/lib/test/activewire.c:92: undefined reference to `usb_register'

/tmp/ccdKE6zL.o(.text+0x6d): In function `activewire_exit':

/home/david/lib/test/activewire.c:99: undefined reference to `printk'

/tmp/ccdKE6zL.o(.text+0x79):/home/david/lib/test/activewire.c:100: undefined reference to `usb_deregister'

/tmp/ccdKE6zL.o(.data+0x40): In function `activewire_init':

/home/david/lib/test/activewire.c:90: undefined reference to `__this_module'

collect2: ld returned 1 exit status

make: *** [activewire.o] Error 1

 

 

The error was solved by adding "-c" option to my makefile:

 

Old file:

activewire.o: activewire.c

gcc -Wall -I/lib/modules/2.4.21-0.13mdk/build/include -g -O -o activewire.o activewire.c

 

 

New file:

activewire.o: activewire.c

gcc -Wall -I/lib/modules/2.4.21-0.13mdk/build/include -g -O -o activewire.o -c activewire.c

 

 

Hope this helps

David

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...