Ok, so I have a project for school that I've been trying to debug myself, but I can't get any further. This is a simple Menu application that will eventually be able to add more items. I can't get it to run, but I've been able to bring it down to 4 errors, and they're all in Menu.h:
Line 19: expression must have constant value
Line 12: 'descript': unknown override specifier
Line 12: missing type specifier - int assumed. Note: C++ does not support default-int
Line 19: expression did not evaluate to a constant
I have a feeling the answer is something really obvious, but I can't see it myself. Thank you in advance!
#ifndef MENU
#define MENU
#include <string>
#include <conio.h>
int maxCount=20; //# Max menu items
struct menuItem
{
void(*func)(); //Pointer to function
string descript; //Member function for menu item name
};
class Menu
{
private:
menuItem mi[maxCount];
int count;
void runSelection();
public:
Menu();
void addMenu(char *Description, void(*f)());
void runMenu();
void waitKey();
};
#endif
Ok! The errors are gone and the program compiles, but when I attempt to run it, it gives me this error in the dialogue window:
'"c:\users\<name>\documents\visual studio 2017\Projects\MainMenu.exe"' is not recognized as an internal or external command, operable program or batch file.
Ok, I don't know what changed, but I went back through and was able to resolve what errors I was now getting. My problem now is that the console window prints nothing but empty space, which I can interact with for about 5 seconds before getting the "press any key to continue" message, which closes the window. Nearly there!
#ifndef MENU
#define MENU
#include <string>
#include <conio.h>
using std::string;
constexprint maxCount = 20; //# Max menu items
struct menuItem
{
void(*func)(); //Pointer to function
string descript; //Member function for menu item name
};
class Menu
{
private:
menuItem mi[maxCount];
int count;
void runSelection();
public:
Menu();
void addMenu(char *Description, void(*f)());
void runMenu();
void waitKey();
};
#endif