I'm taking over a C++ CLI project and one of the files, StartScreen.xaml.h
, is throwing an IntelliSense error in Visual Studio 2013. Here's a fragment of the code:
public ref class StartScreen sealed
{
public:
StartScreen();
void SetApp(App^ app);
void ShowProgressRing();
void HideProgressRing();
internal:
static float imagePercentage;
....
It's that last line that's causing the problem. imagePercentage
throws the error
108 IntelliSense: public data members are not allowed in non-value types
What does this mean and how (if at all - it compiles without compiler errors) should I fix it?
I would guess it is just a bug in IntelliSense. C++/CLI and C++/CX share a syntax, but it seems that there are some rules that are different. In this case, C++/CX doesn't allow public/internal fields:
C++/CLI has no such restriction (that's why it compiles for you). The Intellisense is probably just (incorrectly) sharing this rule between both C++/CLI and C++/CX.
If you really do want an internally visible field, I would just ignore the Intellisense. If it bothers you, and you can change it to a property, then that's your workaround.