My code is: dvController.selectedCountry = selectedCountry;
Why do I get the error "request for member 'selectedCountry' in something not a structure or union"?
My code is: dvController.selectedCountry = selectedCountry;
Why do I get the error "request for member 'selectedCountry' in something not a structure or union"?
You are probably trying to access a property "selectedCountry" on an object, and you forgot to include that header file. (At least that's what I usually do wrong when I get this error.)
also if the types are NOT the same you can get this message. Casting to the right type usually resolves this.
I suspect that dvController
is a pointer (to a structure) and not the structure. You need to use '->
' instead of '.
', perhaps.
I believe that I have encountered this problem when I have a member or variable that hasn't properly been initialized. Check to make sure that each of your objects has memory and is initialized properly.
Also, your question isn't as clear as it could be since there is the local variable selectedCountry and the member. Which one is being referred to here? I would assume the member, if the variable is actually a member of whatever is "self" that might be your problem. Whenever I program, I make sure to make distinctions between locals, members of the current class, and members of other classes so that it's easy to see what's going on when bugs come up. Just a thought.