Thread: can't understand error message.

  1. #16
    Registered User
    Join Date
    Sep 2006
    Posts
    22
    it is for embedded smart card system..

    i'm using smartdeck c compiler..

    well i did some mistake at the declaration part but i have correct it this is te example for the declaration :

    Code:
    typedef struct message
    {
    	unsigned char msg_asal[6];
    	unsigned char msg2[2];
    	unsigned char check[4];
    	unsigned long sum;
    } apdu_data3;
    
    #pragma melpublic
    //unsigned char publicData[136];
    union
    {
                    apdu_data pData;
    	apdu_data2 pData2;
    	apdu_data3 msg;
                    unsigned char pEncdata[16];
    	unsigned char pkeysat[CLkeysat-1];
    	unsigned int pKira1[1];
    	unsigned int pKira2[1];
     } apdu_group1;
    and this is the line where i implement the checksum library :

    Code:
    memcpy(apdu_group1.msg.msg2, apdu_group1.msg.msg_asal, 2);
    memcpy(apdu_group1.msg.check, apdu_group1.msg.msg_asal+2, 4);
    
    CHECKSUM(2, apdu_group1.msg.msg2, apdu_group1.msg.sum);     //line 157
    Last edited by nurulhafiz; 09-13-2006 at 01:53 AM.

  2. #17
    Registered User
    Join Date
    Sep 2006
    Posts
    22
    when i compiled it, i got an error like this one:

    enc1.c(157): error E8002: user type check error: found 'unsigned long', expected 'unsigned long *'

    and when i convert the unsigned long sum; to unsigned long *sum; in the declaration part i got this error:

    enc1.c(157): error E8000: argumenst to _code can only be locals, arguments, globals, or integer

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > found 'unsigned long', expected 'unsigned long *'
    Like I said, you should have done
    Code:
    CHECKSUM(2, apdu_group1.msg.msg2, &apdu_group1.msg.sum);
    Do you have any other example which works?
    Have you tried this with variables which are not in a union?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #19
    Registered User
    Join Date
    Sep 2006
    Posts
    22
    ooo..it works..thnx alot Salem..i didn't understand what u mean back then..i forgot that when ever we want to send address we should include the '&' infront of the var name..thnx again..about the example i don't have any..coz im new in this thing..

Popular pages Recent additions subscribe to a feed