liballeg/allegro_wiki

Error: E0513 a value of type "int" cannot be assigned to an entity of type "ALIEN_TYPE"

Closed this issue · 4 comments

image

Severity Code Description Project File Line Suppression State
Error (active) E0513 a value of type "int" cannot be assigned to an entity of type "ALIEN_TYPE" Project1 C:\source\repos\Project1\Project1\game.cpp 663

I am using VS2022. All exercises before this worked fine.

Can you please let me know what I am doing wrong?

Where is this code coming from?

Depends on the definition of ALIEN_TYPE but you may just need a cast,

aliens[i].type = (ALIEN_TYPE) between(0, ALIEN_TYPE_N);

However, this is the Issue tracker for the Allegro wiki so unless this code is on the Allegro wiki you would be better asking elsewhere, e.g. allegro.cc or Stackoverflow.

This code if from the tutorial Allegro Vivace (https://github.com/liballeg/allegro_wiki/wiki/Allegro-Vivace). I am also using VS2022 and am getting the same error.

Type casting did resolve the issue, I have updated the wiki page with the new code.

I will mark this as closed, due to being fixed.