Question

I was trying to use the sha2.c file from polarssl at this link,

https://polarssl.org/sha-256-source-code

I am actually quite a newbie to this, but I was able to get this on Eclipse and when I tried to build it, it gives the error

c:/mingw/x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text+0x3d): undefined reference to `WinMain'

do I have to pass some kind of data in the arguments? how can I find out how to use it?

Was it helpful?

Solution

The problem is not in the source file you downloaded, but the fact that you need to make 'an application'. Eclipse cannot compile 'just some functionality' unless you instruct it to build a library. You will have to provide a WinMain / main function so that Windows knows what to do when you start the application.

That is what the compiler is complaining about, there is no main() functions it can compile into the application!

Easiest way to start is to start a Generic C Application in Eclipse and then add this sha2 source file and header to that project. The Generic C application project already has a main function you can work from..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top