Problem with "x" differs in levels of indirection from "y"

Discussion in 'C++' started by Tobias Erbsland, Jun 18, 2004.

  1. Hello

    I have a problem with an error message. I created a new class (as
    OpenSSL helper):

    class DataBlock
    {
    public:
    DataBlock();
    DataBlock( unsigned int size );
    DataBlock( const DataBlock& copy );
    DataBlock( const unsigned char* copy, unsigned int copySize );
    ~DataBlock();
    // .... methods and datas...
    };

    Then i use the class in this way:

    void foo()
    {
    unsigned char* sessionKey[1];
    sessionKey[0] = new unsigned char[ EVP_PKEY_size( publicKey ) ];
    int sessionKeySize[1];
    // (...) call the openssl functions

    // problem:
    DataBlock sessionKey( sessionKey[0], sessionKeySize[0] );
    }

    I get the error message (vsc++.net):
    error C2040: 'sessionKey' : 'DataBlock' differs in levels of indirection
    from 'unsigned char *[1]'

    I think i overlooked a fault, but i'd see it... (frustrating... *sigh*)

    best regards
    Tobias Erbsland
    Tobias Erbsland, Jun 18, 2004
    #1
    1. Advertising

  2. Tobias Erbsland

    Sharad Kala Guest

    "Tobias Erbsland" <> wrote in message
    news:cau6ji$g2c$-plus.net...
    >
    > Hello
    >
    > I have a problem with an error message. I created a new class (as
    > OpenSSL helper):
    >
    > class DataBlock
    > {
    > public:
    > DataBlock();
    > DataBlock( unsigned int size );
    > DataBlock( const DataBlock& copy );
    > DataBlock( const unsigned char* copy, unsigned int copySize );
    > ~DataBlock();
    > // .... methods and datas...
    > };
    >
    > Then i use the class in this way:
    >
    > void foo()
    > {
    > unsigned char* sessionKey[1];
    > sessionKey[0] = new unsigned char[ EVP_PKEY_size( publicKey ) ];
    > int sessionKeySize[1];
    > // (...) call the openssl functions
    >
    > // problem:
    > DataBlock sessionKey( sessionKey[0], sessionKeySize[0] );


    sessionKey has already been defined in the code. If your intention is to create
    a new object of type DataBlock then use some other variable name.

    s(sessionKey[0], sessionKeySize[0] );
    Sharad Kala, Jun 18, 2004
    #2
    1. Advertising

  3. >>unsigned char* sessionKey[1];
    >>sessionKey[0] = new unsigned char[ EVP_PKEY_size( publicKey ) ];
    >>int sessionKeySize[1];
    >>DataBlock sessionKey( sessionKey[0], sessionKeySize[0] );

    > sessionKey has already been defined in the code. If your intention is to create
    > a new object of type DataBlock then use some other variable name.


    Thank you very much! (such a stupid mistake ;-)

    best regards
    Tobias
    Tobias Erbsland, Jun 18, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SL
    Replies:
    0
    Views:
    519
  2. Replies:
    2
    Views:
    674
  3. blimeyoreilly
    Replies:
    10
    Views:
    4,544
    Peter Julian
    Jun 26, 2005
  4. Angus
    Replies:
    6
    Views:
    1,311
    matevzb
    Feb 12, 2007
  5. Angus
    Replies:
    2
    Views:
    697
    Clark S. Cox III
    Feb 12, 2007
Loading...

Share This Page