[prog] error: "reference 'main' can not be resolved"

Aslı gosalyn at gmail.com
Wed Nov 9 18:56:58 EST 2005


hi,
i suspected that the message was because the linker could not find a
"main" within the source codes. and then i just tried commenting out
the whole main block, and then building the project. Microsoft Visual
C++ .NET (i know it's a shame talking about using .NET in a linux
mailing list)  The compilation stage was completed without and error,
but then in the linking stage the i got this message:
"unresolved external symbol _main referenced in function _mainCRTStartup"

that has the same meaning with the pseudo error message i was talking about.

So, as to conclude, it was a linker related error..

Thanks again to everyone..

Aslı


On 09/11/05, Gareth Anderson <Gareth.Anderson at acslink.net.au> wrote:
> Hmm, I think I'll chip in my 2cents too :)
> I just finished studying Programming languages and implementation and am
> still unsure as to where the error would occur.
>
> Here are the relevant lectures (warning large - ~1meg or so)
> http://www.csse.monash.edu.au/courseware/cse3322/2005/04imp/lectImpX4.pdf
>
> I was originally thinking that the compiler might get the error message
> during the "semantic analysis" which checks the semantics of the code and
> gives them values. However this doesn't make sense as you compile multiple
> files with only one having a main so this doesn't seem to work
>
> At the end of compliation stage, target code is generated, I'm not sure if
> target code could be generated without a "main" program because this doesn't
> make sense in C (does it? its being 2 years :P).
>
> Otherwise the linker might pickup the error, however I'm not sure. If no one
> has suggestions I might ask my lecturer this question...
>
> Regards,
> Gareth
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/programming
>


More information about the Programming mailing list