undefined reference to 'main'

Mark Mussetter mark at link-comm.com
Sat Jan 10 00:08:54 UTC 2004


Hello Everyone,

I'm having problems building a demo called nxscribble for microwindows 
running on RTEMS running on a motorola 5272.  The build progresses fine 
until the I get the following error about an undefined reference to 'main':

<SNIP>
/opt/rtems-4.6/bin/m68k-rtems-gcc   -I. -I../../include -Wall -Wno-unused 
-m5200 -g -O2 -B/rtems/build-4.6.0pre5-cfv2_66/m68k-rtems/cfv2_66/lib/ 
-specs bsp_specs -qrtems  -L../../lib nxscribble.o scribwidget.o hre_api.o 
li_recognizer.o bitvector.o matrix.o sc.o util.o -o ../../bin/nxscribble 
../../lib/libnano-X.a ../../lib/libmwengine.a ../../lib/libmwdrivers.a 
../../lib/libmwfonts.a  -lm

/rtems/build-4.6.0pre5-cfv2_66/m68k-rtems/cfv2_66/lib/librtemscpu.a(dummy.o)(.data+0x2c): 
undefined reference to `main'
<END SNIP>

I looked at the source for dummy.c to see where it was trying to reference 
'main' and found that it has a prototype as follows:
int main( int, char **, char ** );

It also has the following line a little later in the file:
#define CONFIGURE_INIT_TASK_ENTRY_POINT (void *)main

We have our own 'main' function in 'nxscribble.c' but 'dummy.c' seems to be 
getting in the way.  We noticed that the prototype in 'dummy.c' didn't 
match our main declaration.  In 'nxscribble.c' main was "int main( int 
argc, char **argv )", so we changed it to "int main( int argc, char **argv, 
char **env )" to match 'dummy.c'.  However, this didn't help.

Can someone please point us in the right direction?

Thanks in advance for any help,

Mark




More information about the users mailing list