PRB: "UNRECOVERABLE APPLICATION ERROR: No Main Procedure"

ID Number: Q78202

1.00

WINDOWS

Summary:

SYMPTOMS

When starting a Windows or QuickWin application built with

Microsoft QuickC for Windows (QC/Win) version 1.0, the following

message may appear:

UNRECOVERABLE APPLICATION ERROR

no main procedure

CAUSE

This message is generated if the application in question does not

have a main() or WinMain() function defined. Because the C startup

code uses weak externals to allow WinMain() to fix up main(), it

is impossible to issue the message at compile time, as is done for

a DOS EXE. A stub delivers the error message during run time.

RESOLUTION

To avoid this error, make sure that you define the proper entry

point:

WinMain() for a Windows .EXE

main() or WinMain() for a QuickWin .EXE

More Information:

The C startup code makes a weak external call to the main() function.

If main() cannot be found, then a stub version of main() [the stub

that gets control if there is no main() function in the program] makes

a weak external call to WinMain(). If WinMain() cannot be found, a

stub version of WinMain() issues the UAE.

Note that if a Windows .EXE has main() declared with the C calling

convention or _main() declared with the Pascal calling convention, the

program will compile successfully and the UAE will not occur. However,

the program will terminate normally during execution of the startup

code, never entering the application code.

Additional reference words: 1.00