Hi guys I was implementing a wheel of destiny when I want to fill out the file I don't fill out for the following any error and so kind as to give me a hand to solve this error?
int CWheelDestiny::PickAGift()
{
const auto Chance = GetChance();
while (true)
{
const auto rand_pos = number(0, WheelItemMax - 1);
const auto& [item, count, m_chance] = m_Data[rand_pos];
if (Chance >= m_chance)
{
SetGift(item, count);
return rand_pos;
}
}
return -1; // error
}
wheel_of_destiny.cpp: In member function 'int CWheelDestiny::PickAGift()': wheel_of_destiny.cpp:98:15: error: expected unqualified-id before '[' token const auto& [item, count, m_chance] = m_Data[rand_pos]; ^ wheel_of_destiny.cpp:98:15: error: expected initializer before '[' token
wheel_of_destiny.cpp17: error: 'm_chance' was not declared in this scope if (Chance >= m_chance) { ^~
wheel_of_destiny.cpp:101:12: error: 'item' was not declared in this scope SetGift(item, count); ^~
wheel_of_destiny.cpp:101:18: error: 'count' was not declared in this scope SetGift(item, count); ^~~ compiling main.cpp
wheel_of_destiny.cpp:101:18: note: suggested alternative: In file included from /usr/local/lib/gcc6/include/c++/algorithm:62:0, from stdafx.h:19, from
wheel_of_destiny.cpp:1: /usr/local/lib/gcc6/include/c++/bits/stl_algo.h:3961:5: note: 'std::count' count(_InputIterator first, _InputIterator last, const _Tp& __value) ^~~
Complete file: