27 Mar, 2013, arholly wrote in the 1st comment:
Votes: 0
Hello:
I've been doing some coding and started getting this error when I compiled:
Quote
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make[1]: *** [rom] Error 1


Now, it looks like my main is right in comm.c
int	main			args( ( int argc, char **argv ) );

int main( int argc, char **argv )


What could I have wrong?
27 Mar, 2013, Rarva.Riendf wrote in the 2nd comment:
Votes: 0
http://linux.derkeiler.com/Newsgroups/co...

probably the -c option in your makefile

and supress the int main args( ( int argc, char **argv ) ); totally useless as well.

you may have a some other code test you forgot about as well

check with a more * | grep "main*("
27 Mar, 2013, arholly wrote in the 3rd comment:
Votes: 0
No, the -c option is there.
Quote
gcc -c -Wall -g -ggdb3 magic2.c
gcc -c -Wall -g -ggdb3 mob_cmds.c
gcc -c -Wall -g -ggdb3 mob_prog.c
gcc -c -Wall -g -ggdb3 music.c
gcc -c -Wall -g -ggdb3 olc.c
gcc -c -Wall -g -ggdb3 olc_act.c
gcc -c -Wall -g -ggdb3 olc_mpcode.c
gcc -c -Wall -g -ggdb3 olc_save.c
gcc -c -Wall -g -ggdb3 protocol.c
gcc -c -Wall -g -ggdb3 recycle.c
gcc -c -Wall -g -ggdb3 save.c
gcc -c -Wall -g -ggdb3 scan.c
gcc -c -Wall -g -ggdb3 skills.c
gcc -c -Wall -g -ggdb3 special.c
gcc -c -Wall -g -ggdb3 string.c
gcc -c -Wall -g -ggdb3 tables.c
gcc -c -Wall -g -ggdb3 update.c
gcc -c -Wall -g -ggdb3 wizlist.c
gcc -c -Wall -g -ggdb3 wizutil.c
rm -f rom
rm -f rom.exe
gcc -ggdb3 -o rom act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wi z.o alias.o ban.o bit.o board.o comm.o const.o db.o db2.o effects.o fight.o flag s.o handler.o healer.o hedit.o interp.o lookup.o magic.o magic2.o mob_cmds.o mob _prog.o music.o olc.o olc_act.o olc_mpcode.o olc_save.o protocol.o recycle.o sav e.o scan.o skills.o special.o string.o tables.o update.o wizlist.o wizutil.o -lc rypt -lm
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [rom] Error 1
27 Mar, 2013, Rarva.Riendf wrote in the 4th comment:
Votes: 0
Well try to revert the latest change you did before it stopped compiling. It may not be related to your main function at all. Maybe some other linking problem that leads to it not finding the main.
After all if it compiled before, no reason it would generate a compile error now if you did not change anything in this file.

I do expect you to have some kind of versioning system by now.
27 Mar, 2013, arholly wrote in the 5th comment:
Votes: 0
Yeah, I do. :) But I was hopeful to figure out what I did so I don't do it again. :)
27 Mar, 2013, Tyche wrote in the 6th comment:
Votes: 0
Did you add a file to your makefile?
The link edit step above looks suspicious. Is it more than the formatting? Are you missing a tab character?
— "gcc -ggdb3 -o rom act_comm.o …"
27 Mar, 2013, salindor wrote in the 7th comment:
Votes: 0
You know a really useful tool is winmerge.

Just put both make files in it and it will graphically show you saves and tabs and where exactly each delta is
28 Mar, 2013, Rarva.Riendf wrote in the 8th comment:
Votes: 0
arholly said:
Yeah, I do. :) But I was hopeful to figure out what I did so I don't do it again. :)


You will figure it out faster by looking at what change broke the compiling chain.
Messages from compiling (especially from GCC) are often misleading. As the same 'final' message can come from multiple reasons.

Especially one that says undefined reference to main.
31 Mar, 2013, quixadhal wrote in the 9th comment:
Votes: 0
You probably messed up one of the #ifdef blocks… many codebases have them to support windoze, as it needs a different "main" entry point routine.
0.0/9