我有代码的问题从书:错误使用的typedef的typedef
const int SQUARE_ARRAY_SIZE = 4;
const int SQUARE_INFO_SIZE = 4;
typedef Square SquareArray[SQUARE_ARRAY_SIZE];
typedef SquareArray SquareInfo[SQUARE_INFO_SIZE];
SquareArray RedGeneric = { Square(0, 0), Square(0, 1),
Square(1, 1), Square(1, 0) };
SquareInfo RedInfo = { &RedGeneric, &RedGeneric, \\problem here
&RedGeneric, &RedGeneric };
它破口大骂:
转换错误C2440: '初始化':无法从“SquareArray(转换* )”到 '广场'
智能感知:没有合适的构造存在,从 “SquareArray *” 到 “广场”
据我了解SquareInfo代表SquareArray的阵列,但好像vs2013想打破它广场和结果
SquareInfo m_squareInfo; ...
SquareArray* pSquareArray = m_squareInfo[m_iDirection];
破口大骂:
智能感知:类型的值“常量广场* “不能用于初始化类型的实体‘SquareArray *’
书是从2008年,我不知道它的工作当时或有错误的开始。至于q请告诉我什么是错误的以及如何使它工作。
将该书扔进垃圾箱。 – 2015-02-09 18:44:15
你确定这本书写了'typedef SquareArray SquareInfo [SQUARE_INFO_SIZE];'而不是'typedef SquareArray * SquareInfo [SQUARE_INFO_SIZE];'?无论如何,这似乎意味着后者。 – 2015-02-09 18:45:12
什么书?或者它只是被称为“书”? – 2015-02-09 18:49:51