Compiler Error C3065

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3065.

property declaration at non-class scope is not allowed

The property __declspec modifier was used outside a class. A property can only be declared inside a class.

The following sample generates C3065:

// C3065.cpp  
// compile with: /c  
__declspec(property(get=get_i)) int i;   // C3065  
  
class x {  
public:  
   __declspec(property(get=get_i)) int i;   // OK  
};  

Show: