I'm working on a project in Visual Studio that includes a "portable" menu GUI for anyone who wants it in their own work. Since I keep getting the C2797 compiler error, I can't use structs at all since nothing has helped and I use classes a lot.
Basically, I can't use structs, even though it's the most important part of my project.
Menu.h:
struct menuItem
{
const char *name;
bool value;
};
Test.h:
#include "Menu.h"
class Test
{
public:
menuItem dummy = { "Useless option", false }; // <--This is where I get C2797
};
Again, this won't compile, but if I use this exact code in a simple C++ console app, it works flawlessly on all compiler versions.
If you need more details, when I use structs outside of classes, I get C4430 intertwined with C2440 and C2065. (And adding cstdint doesn't help that) If I try using the exact same struct in the closest situation possible in a different project, it compiles with all compiler versions just fine.
For the people who might think that it's because of the VS 2013 compiler (Which I'm using), I've already switched between newer and older versions between all of my projects and it made no difference.