This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS: connect_config ----------expression must have a constant value



Tool/software: Code Composer Studio

hi :

 while i write "connect_config *local_con_conf = (connect_config *)app_hndl;"  to set as the global value in the mqtt'client demo proejct

to publish the message. it will show "expression must have a constant value" error.but if you put the value as the temp in th function ,

it will not this error ,not only  can't call the send lib'function to send message but also the system will hang up.

maybe it was a real time context flag .i don't how to correct this issue.some suggestion will be helpful.

  • Hello,

    The following comment is from my colleague, who is most knowledgeable regarding the compiler:

    ---

    Outside of a function, you can only have assignment statements where the right side is constant.  The expression ...

    void *app_hndl = (void*)usr_connect_config;

    … is an interesting example where the right side is constant.  usr_connect_config is an array.  Any bare appearance of the name is the same as writing &usr_connect_config[0], i.e. it is constant.

    The right side in this expression is not constant …

    connect_config *local_con_conf = (connect_config *)app_hndl; 

    app_hndl is a pointer variable.  When executed in the context of a function, the right side is a memory location which must be loaded. 

    ---

    thanks

    ki