C - Troubleshoot                                        Home : www.sharetechnote.com






C1859 - fatal error C1859 : unexpected precompiled header


If you get this error in DotNet 2008 (may be working in other versoin as well), Disabling 'Create/Use Precompiled Header' might solve the problem. See Enabling/Disableing Precompiled Header for the details.



C2664 - Compiler Error C2664


This error would take many different form depending on situation and would print out as ''function' : cannot convert parameter number from 'type1' to 'type2''


Example 1 >


Code causing the error:

    HMODULE hDll = LoadLibrary("user32.dll");

Error Message :

    error C2664: 'LoadLibraryW' : cannot convert parameter 1 from 'const char [11]' to 'LPCWSTR'

Solution :

    HMODULE hDll = LoadLibrary(L"user32.dll");



Run-Time Check Failure #3 - The variable XXXXXXX is being used without being initialized.


< Case 1 > cause this error because the pointer myStrPtr is not initialized (in this case it means that no memory is allocated to store the array of chars (string). < Case 2 > removes the error.


< Case 1 >

    char *myStrPtr;

    strcpy(myStrPtr,"Hello World");


< Case 2 >

    char *myStrPtr;

    myStrPtr=(char *)malloc(20);

    strcpy(myStrPtr,"Hello World");