Reputation: 3064
struct imageInfo{
enum SliceOrientation
{
XY_PLANE = 0,
XZ_PLANE = 1,
YZ_PLANE = 2,
UNCHOSEN = 3
}
sliceOrientation;
int xOnViewer;
int yOnViewer;
std::string sourceName;
int viewerWindowWidth;
int viewerWindowHeight;
};
int main()
{
imageInfo image;
image.sliceOrientation = UNCHOSEN;
}
Why does the compiler keep saying UNCHOSEN is not defined? Can you tell me what exactly I am doing wrong in constructing and using the Enum
SliceOrientation
as a member of the struct
imageInfo
? I meant to make this code for c++.
Thanks
Upvotes: 0
Views: 39
Reputation: 25409
SliceOrientation
is a nested type of imageInfo
so you need to qualify its name outside that struct
. If you write
image.sliceOrientation = imageInfo::UNCHOSEN;
in your main
, it will compile.
Upvotes: 2