Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: global star...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 8 Topic 4574 of 4710
Post > Topic >>

Re: global start, global main or anything I want?

by Robert Redelmeier <redelm@[EMAIL PROTECTED] > Mar 16, 2008 at 10:32 PM

phoenix <spamtrap@[EMAIL PROTECTED]
> wrote in part:
> and then I type: gcc ass.o -o as***e
> 
> An error message appears:
> /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function
> `_start':
> (.text+0x18): undefined reference to `main'
> collect2: ld returned 1 exit status


> If the label (in the program) is called main (and not prog),
> there's no error message.  If the label is called start,
> the error message appears again.

> My question is: can I choose whatever label names in my
> program, without having all these error messages? Or am I
> forced to always insert a label called "main" in my code?


In addition to the other fine responses you've received,
I would add you should look at the `gcc` manpage, particularly
under the -nostdlibs and -nostartfiles options.

Every Linux executable (both a.out and ELF) needs a global
entry point labeled _start .  gcc startfiles provides this,
but then needs an entrypoint called main.

-- Robert
 




 8 Posts in Topic:
global start, global main or anything I want?
phoenix <spamtrap@[EM  2008-03-16 10:51:20 
Re: global start, global main or anything I want?
Tim Roberts <spamtrap  2008-03-16 21:25:30 
Re: global start, global main or anything I want?
Terence <spamtrap@[EM  2008-03-16 14:19:02 
Re: global start, global main or anything I want?
Frank Kotler <spamtra  2008-03-16 21:58:37 
Re: global start, global main or anything I want?
Robert Redelmeier <red  2008-03-16 22:32:37 
Re: global start, global main or anything I want?
phoenix <spamtrap@[EM  2008-03-17 03:25:33 
Re: global start, global main or anything I want?
Frank Kotler <spamtra  2008-03-17 21:27:21 
Re: global start, global main or anything I want?
phoenix <spamtrap@[EM  2008-03-19 01:01:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 19:23:05 CDT 2008.