meaning of the error ?

R

ranjeet.gupta

Dear All

While building the the project,
I am geting the two errors at linking stage.

Can any help me out what these exactly means ??

Linking...
Creating library Debug/15JulyBulid.lib and object
Debug/15JulyBulid.exp
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/15JulyBulid.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

15JulyBulid.exe - 2 error(s), 0 warning(s)

Thanks In Advance
Ranjeet
 
E

Emmanuel Delahaye

While building the the project,
I am geting the two errors at linking stage.

Can any help me out what these exactly means ??

Linking...
Creating library Debug/15JulyBulid.lib and object
Debug/15JulyBulid.exp
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/15JulyBulid.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

15JulyBulid.exe - 2 error(s), 0 warning(s)

Sounds not to be a C-queston. More likely it's a compiler/linker issue.
You should read more carefully your compiler/linker manual about 'how
to make a library' or 'how to make an executable' depending what you
want to do exactly.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"There are 10 types of people in the world today;
those that understand binary, and those that dont."
 
K

Ken

Hi Ranjeet,

Frankly, It's only one error.

I have a quesition. What type of application do you want to build?
executive or library?

It seems like you are building a library but you choosed wrong
application type.

Ken
 
B

Ben Pfaff

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

Your C program does not contain a function named main().
Every portable C program must.
 
P

Peter Shaggy Haywood

Groovy hepcat Ben Pfaff was jivin' on Sat, 16 Jul 2005 16:40:06 -0700
in comp.lang.c.
Re: meaning of the error ?'s a cool scene! Dig it!
Your C program does not contain a function named main().
Every portable C program must.

Every portable C program in a hosted environment, that is.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 
B

Ben Pfaff

Groovy hepcat Ben Pfaff was jivin' on Sat, 16 Jul 2005 16:40:06 -0700

Every portable C program in a hosted environment, that is.

There are no portable C programs in freestanding environments.
For example, in a freestanding environment there is no way to
predict the name of the program startup function.
 
V

vire

i've tried to build some code which don't have a main function.
yes ,it proves u're right.
but i heard someone said that the c program sometimes can run without a
main function .then what is that?
 
K

Kenny McCormack

i've tried to build some code which don't have a main function.
yes ,it proves u're right.
but i heard someone said that the c program sometimes can run without a
main function .then what is that?

Troll.
 
S

S.Tobias

Ben Pfaff said:
Your C program does not contain a function named main().
Every portable C program must.

Really? I wonder, if a program doesn't have `main', is it UB, or CV?
Which rule is violated?

[always assuming hosted implelementation]
 
S

Serge Paccalin

Le mardi 19 juillet 2005 à 08:57, vire a écrit dans comp.lang.c :
i've tried to build some code which don't have a main function.
yes ,it proves u're right.
but i heard someone said that the c program sometimes can run without a
main function .then what is that?

The important word in Ben's answer was "portable".

Non-portable programs may run without a main() function if there is an
alternative in their environment (like WinMain() in Windows, for
instance).

Note: to answer properly with Google, don't click Reply, click Show
Options and then click the Reply that appears among those options.

--
___________ 19/07/2005 09:49:59
_/ _ \_`_`_`_) Serge PACCALIN -- sp ad mailclub.net
\ \_L_) Il faut donc que les hommes commencent
-'(__) par n'être pas fanatiques pour mériter
_/___(_) la tolérance. -- Voltaire, 1763
 
R

Richard Bos

S.Tobias said:
Really? I wonder, if a program doesn't have `main', is it UB, or CV?

What is CV? (Except Curriculum Vitae, which hardly seems to apply here;
Curriculum Programmis would be more appropriate...)
Which rule is violated?

5.1.2: "program startup occurs when a designated C function is called by
the execution environment"; and 5.1.2.2.1#1: "The function called at
program startup is named main". Since there is, AFAICT, no clause
defining what happens if a function is called which was not actually
defined in the program[1], running a program which doesn't define main()
in a hosted environment has undefined behaviour.

Richard

[1] Which is quite possible even for other functions: link an executable
using a dynamic library, then remove that library, for example.
 
S

S.Tobias

Richard Bos said:
What is CV? (Except Curriculum Vitae, which hardly seems to apply here;
Curriculum Programmis would be more appropriate...)

"Constraint violation". I thought people had used this abbreviation here.
Which rule is violated?

5.1.2: "program startup occurs when a designated C function is called by
the execution environment"; and 5.1.2.2.1#1: "The function called at
program startup is named main". Since there is, AFAICT, no clause
defining what happens if a function is called which was not actually
defined in the program[1], running a program which doesn't define main()
in a hosted environment has undefined behaviour.
[1] Which is quite possible even for other functions: link an executable
using a dynamic library, then remove that library, for example.

I see, so its UB by omission of definition, and the compiler/linker
is not required to diagnose lack of `main'.

Thank you.
 
R

Richard Bos

S.Tobias said:
"Constraint violation". I thought people had used this abbreviation here.

Ah. Well, a constraint violation, if the compiler lets you get away with
it, automatically means UB as well. But no, it does not require a
diagnostic, as far as I can see.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,274
Latest member
JessMcMast

Latest Threads

Top