problem building exe files

Started by rodan07, December 26, 2010, 11:12:05 PM

Previous topic - Next topic

rodan07

Hello all,

I'm new to using Pelles C, and C itself.

I'm copying some programs out of the Kernighan/Ritchie book, but I keep getting this error when trying to build an executable out of source code:

Building fahrenheit.exe.
POLINK: error: Unresolved external symbol '_WinMain@16'.
POLINK: fatal error: 1 unresolved external(s).
*** Error code: 1 ***
Done.

Does anyone know how to get around this?

Thanks,

Rodan

CommonTater

You need to use

#define WIN32_DEFAULT_LIBS
#include <windows.h>

at the top of each file for a windows program.

The WIN32_DEFAULT_LIBS is optional and specific to PellesC ... what it does is tell the linker which windows libraries to include while constructing the final EXE file...

If you are going to try your hand at windows programming you will also need the Windows Software Development Kit (SDK) which give you full disclosure of all windows calls...

You can download it here...
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b&displaylang=en


TimoVJL

If your program has main-function then select from projects linker options Subsystem Type Console.
May the source be with you