Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com From: "Joe Smith" Subject: Re: error: undefined reference to `_WinMain AT 16' Date: Sun, 30 Oct 2005 23:33:18 -0500 Lines: 60 Message-ID: References: <436579B4 DOT 7020405 AT verizon DOT net> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-IsSubscribed: yes "Fernando Barsoba" wrote in message news:436579B4 DOT 7020405 AT verizon DOT net... > Hi, > > I'm trying to build a project with sha-1 and md5 implementations from > http://www.cr0.net:8040/code/crypto/sha1/ (in case it is important > information) > > and I'm getting the following error: > > > **** Incremental build of configuration Debug for project Sha1 **** > > make -k all > Building file: ../sha1.c > Invoking: GCC C Compiler > gcc -O0 -g3 -Wall -c -fmessage-length=0 -osha1.o ../sha1.c > Finished building: ../sha1.c > > Building target: Sha1.exe > Invoking: GCC C Linker > gcc -oSha1.exe ./sha1.o > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o)(.text+0xab): > undefined reference to `_WinMain AT 16' > collect2: ld returned 1 exit status > make: *** [Sha1.exe] Error 1 > make: Target `all' not remade because of errors. > Build complete for project Sha1 > > Any idea why is that? It's the first time is happening as far as I > remember.. Windows compilers actually rename the function called 'main'. I'm not sure what the reason is. The most obvious reason is that the code in the crt (c runtime) is run before main, but the actual entry point of the application (in the crt) is not named main. In Microsoft's crt it is named 'WinMainCRTStartup' (or 'wWinMainCRTStartup' for unicode applications). Cygwin uses the same renaming for consistancy (besides, I think it uses Microsoft's crt anyway.) If you are compiling just the files you linked for the included stand alone test applicaton (that is the only thing sha1.exe could be)read this: The problem is that the code you referenced has no 'main' function. Look closely at the code and you will see you need to define 'TEST'. Otherwise if you are trying to use it in a project of your own: You need to just include the files in the other project such that they are linked directly into the application. If you need more assistance you should contact somebody exepirenced with c, and with using Eclipse to compile c code. If they are at all confused regarding this error message just tell them that it is exactly equivelent to a message of "undefined reference to `_main'". -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/