Eduardo
Eduardo

Reputation: 1

C++ - undefined reference to `WinMain@16

I got a .h and .cpp codes on a website and I am trying to compile them. This is the website that contains the codes: http://raphaelcruzeiro.com/blog/implementing-a-sha1-algorithm-in-c/

I am creating a new project, selecting "console application" and adding the .h and the .cpp files to the project, but when I try to compile I always get this error "undefined reference to `WinMain@16".

I tried DevC++ and Codeblocks both of them got the same error.

Please I want all details on how to compile these files, is there a #include to use? If you guys please make a simple step by step I would be very glad.

On this website http://raphaelcruzeiro.com/blog/implementing-a-sha1-algorithm-in-c/ you will find the .h and the .cpp codes.

Thanks in advance

Upvotes: 0

Views: 1122

Answers (1)

All C++ programs require some sort of main() function, which is where they start executing. The code on the website has no main(), causing the compiler to complain (and rightly so - the program wouldn't know where to start).

You'll need to add something like the following to your .cpp file:

int main(int argc, char **argv) {
  /* code to do SHA1 stuff */
  return 0;
}

Upvotes: 2

Related Questions