Für mich unlösebare Fehler



  • Ich hoffe ihr könnt mir helfen:

    main.cpp: In function LRESULT WindowProcedure(HWND__*, UINT, WPARAM, LPARAM)': main.cpp:115: error: invalid conversion from \void*' to `char*'

    main.cpp:168: error: invalid conversion from `void*' to `char*'

    main.cpp:181: error: case label `2' not within a switch statement

    main.cpp: At global scope:
    main.cpp:187: error: expected unqualified-id before "return"
    main.cpp:187: error: expected ,' or;' before "return"
    main.cpp:188: error: expected declaration before '}' token

    make.exe: *** [main.o] Error 1

    Execution terminated

    char *buffer = NULL;
                int iLength;
    
                iLength = GetWindowTextLength(hEdit);
    
                buffer = malloc(iLength); // 168
    
    case WM_DESTROY:
            {
                PostQuitMessage(0); // 183
                return 0;
            }
    


  • Zu dem ersten Fehler guck dir mal die C++-casts an.
    Zu dem zweiten Fehler guck dir an wie switch funktioniert (nahezu beliebiges C++-Tutorial).
    🙂



  • Müsste es nicht auch so gehen?

    #include <stdlib.h>
    #include <iostream.h>
    
    int main(void) {
     char *buffer = NULL;
     int iLength;
     itoa(iLength, buffer, 10);
     iLength = GetWindowTextLength(hEdit);
     buffer = malloc(iLength); 
    }
    

Anmelden zum Antworten