Start New Discussion within our Software Development Community

I receive this error in a c++ program after moving the program from Mac OS X to windows...I was using XCode, I am now using Visual C++...I looked up the error codfe but don't understand how to apply the solution. Here is the solution as stated by microsoft:

A type appears as the right operand of a member-access (.) operator.

This error can be caused by trying to access a user-defined type conversion. Use the keyword operator between the period and type.

The following sample generates C2286:

Copy// C2274.cpp

struct MyClass {
   operator int() {
      return 0;
   }
};

int main() {
   MyClass ClassName;
   int i = ClassName.int();   // C2274
   int j = ClassName.operator int();   // OK
}

Here is my code:

struct connectFlush {
	bool trueConnectFlush;
	bool connectFlush;
	int highCard;
	int trueHighCard;
	double odds[3];
}DetConnectFlush();

connectFlush DetConnectFlush(int c1, int c2, int f1, int f2, int f3, int trn, int rvr, int round, int f1SV, int f2SV, int f3SV, int trnSV, int rvrSV, int cardSV1, int cardSV2, int flushSuitVal, bool trueFlush)
{
	connectFlush infunc;
	infunc.connectFlush=false;  //C2274
	infunc.trueConnectFlush=false; //C2274
	infunc.highCard=0; infunc.trueHighCard=0; //C2274

...

return infunc;
}

The error is thrown for every line above...how do I modify my code to operate under Visual C++?

Problem Solved...the declaration for a member of the struct (bool connectFlush) was the same as the name of the struct...I changed the declaration...problem solved

This article has been dead for over six months. Start a new discussion instead.