[Solved] Local function definitions are illegal


main is the entry point function for a console app. It must be in global scope. You cant nest functions inside of other functions anyway.

Try something more like this instead:

BOOL CBasicApp::InitInstance()
{
    typedef BOOL (__stdcall *pFunc)();

    HMODULE hMod = LoadLibrary("dbgghelp.dll");
    if (!hMod)
    {
        printf("Error loading dbgghelp.DLL\n");
        return FALSE;
    }

    pFunc pf = GetProcAddress(hMod, "L100A6F95");
    if (!pf)
    {
        printf("Error finding L100A6F95 function\n");
        FreeLibrary(hMod);
        return FALSE;
    }

    if (!pf())
    {
        printf("L100A6F95 function failed\n");
        FreeLibrary(hMod);
        return FALSE;
    }

    FreeLibrary(hMod);
    return TRUE;
}

...

int main(int argc, char* argv[])
{
    CBasicApp app;
    if (app.InitInstance())
    {
        ...
    }
    else
    {
        ...
    }
}

solved Local function definitions are illegal