error C2055: expected formal parameter list, not a type list
These notes have kindly been provided by Sujith Joseph, in India:
The error message:
PetzoldBookProjects\HelloMsg\HelloMsg.c(15) : error C2055: expected formal parameter list, not a type list
Error executing cl.exe.
On compiling the following code:
const TCHAR szOperation = _T("open");
const TCHAR szAddress = _T("www.cryer.co.uk");
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR lpCmd, int nShow)
HINSTANCE hRslt = ShellExecute(NULL, szOperation, szAddress, NULL, NULL, SW_SHOWNORMAL);
assert( hRslt > (HINSTANCE) HINSTANCE_ERROR);
The line on which the error was indicated is highlighted in bold.
The second parameter of WinMain defined only the type HINSTANCE of the parameter. Declaring both the type and identifier of the second parameter as below got rid of the error:
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hprevInst, LPSTR lpCmd, int nShow)
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.