samedi 23 juillet 2016

C: variable with random value debugger error

In a function I have a local variable which is initialized at the beginning. Further in the code this variable is "filled" with a random value, generated with rand() It doesn't work and the debugger tells me:

  random_color_value  Failed getting location list for symbol die# 0x4b9  Error

This is a snippet of the code:

struct cRGB colorFade(void){    
    uint8_t random_color_value; 
   .
   .
   .        
   srand(2);
   random_color_value = rand() % 12 +1; // generate random value between 1 and 12 (including 12) 
   .
   .
   . 
}

The compiler inside my AVR-Studio is set to optimize for size. What could cause that problem?




Aucun commentaire:

Enregistrer un commentaire